https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100801
Matthijs van Duin <matthijsvanduin at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matthijsvanduin at gmail dot com --- Comment #3 from Matthijs van Duin <matthijsvanduin at gmail dot com> --- Simpler testcase: /* compiler flags required to trigger warning: -O1 -ftree-vrp */ static void foo(int *x, long n) { long i = 0; for (; i + 4 <= n; i += 4) { } for (; i < n; i++) { x[i]++; } } void bar(int *x) { foo(x, 128); } A workaround with no runtime overhead is adding the following check between the loops: if (__builtin_constant_p(n % 4 == 0) && n % 4 == 0) return;