http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58377
--- Comment #3 from Roland Dreier <rbd at debian dot org> --- Even simpler test case for me: $ cat x.cpp // gcc -Og -Wall -Werror -c x.cpp int pop (); int pop_first_bucket; int my_pop () { int out; while (pop_first_bucket) if (pop_first_bucket && (out = pop())) return out; return 0; } $ for o in Og O0 O1 O2 O3 Ofast; do echo === $o ===; gcc -$o -Wall -Werror -c x.cpp; done === Og === x.cpp: In function ‘int my_pop()’: x.cpp:8:9: error: ‘out’ may be used uninitialized in this function [-Werror=maybe-uninitialized] int out; ^ cc1plus: all warnings being treated as errors === O0 === === O1 === === O2 === === O3 === === Ofast === Does not error when built as x.c: $ cp x.cpp x.c; for o in Og O0 O1 O2 O3 Ofast; do echo === $o ===; gcc -$o -Wall -Werror -c x.c; done === Og === === O0 === === O1 === === O2 === === O3 === === Ofast ===