https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55217
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2015-11-11 CC| |msebor at gcc dot gnu.org --- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> --- 6.0.0 20151111 issues the following slightly different warnings which disappear when the increment of r in the first loop is made undonditional. Since the condition should always be true (r can never be zero), the warning on that line seems pointless (though not necessarily incorrect -- GCC is right to assume there's no overflow). I don't really know what to make of this so I'm leaving it UNCONFIRMED and for someone else to look into in more depth. $ cat u.c && /home/msebor/build/gcc-trunk/gcc/xgcc -B /home/msebor/build/gcc-trunk/gcc -O2 -S -Wstrict-overflow=3 -o/dev/null -std=c99 u.c void h(int *s); void f(int n, int s) { int r = 1; for (int i = 1; i < n; i++) if (r) r++; if (r * s >= s + 3) // warning here for (int j = 0; j < r; j++) h(&s); } u.c: In function âfâ: u.c:7:20: warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow] if (r) ^ u.c:10:17: warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow] for (int j = 0; j < r; j++) ^ u.c:10:17: warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow]