https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63943
Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vincent-gcc at vinc17 dot net --- Comment #2 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> --- Another test case: int foo (void) { int i = 0, t; if (i > 0) t = i; if (t != 0) return 1; return 0; } int main (void) { return foo () + foo () + foo () + foo (); } With -O1, I get 1 warning for foo and 1 for main. With -O2, I get 1 warning for foo and 4 for main. The warnings for main disappear if I add __attribute__((noinline)) on foo. Surprisingly, they also disappear if I just remove the code related to variable i. Tested with: gcc (Debian 20170823-1) 8.0.0 20170823 (experimental) [trunk revision 251306]