http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265
--- Comment #27 from Paul Pluzhnikov <ppluzhnikov at google dot com> 2013-04-29 23:18:29 UTC --- Here is a reduced test case in which g++ (GCC) 4.9.0 20130426 (experimental) produces infinite loop with -O2 due to aggressive loop optimization, but doesn't warn (making the bug in user code hard to find). g++ -O2 test.cc -Wall && ./a.out Segmentation fault g++ -O2 test.cc -Wall -fno-aggressive-loop-optimizations && ./a.out && echo ok ok struct Puzzle { int r[9]; int ignored[18]; } p; int a, b; int main() { int c = 0; for (b = 0; b < 27; b++) { if (p.r[b] == 0) c |= p.r[a]; if (c != 0) return c; } return c; }