https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69578
Peter Selinger <selinger at mathstat dot dal.ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |selinger at mathstat dot dal.ca --- Comment #4 from Peter Selinger <selinger at mathstat dot dal.ca> --- I ran into the same bug with this code: double weight() { double sum; int i; for (i=0; i<10; i++) { sum++; } return sum; } With -Wuninitialized or -Wmaybe-uninitialized, no warning is generated with -O0. The warning is generated with -O1, -O2, -O3. Other compilers (such as clang) generate the warning correctly. Confirmed with gcc 8.2.0.