http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56354
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID Severity|major |normal --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-02-16 03:53:07 UTC --- i * 400000000 overflows when i is 6 which is causing the code to turn into an infinite loop. Use the option -fwrapv or -fno-aggressive-loop-optimizations to workaround your issue. A simple printf added shows the issue: i=0, i*X=0 i=1, i*X=400000000 i=2, i*X=800000000 i=3, i*X=1200000000 i=4, i*X=1600000000 i=5, i*X=2000000000 i=6, i*X=-1894967296