[Bug c/36862] Optimization O2 causes infinite loop

paolo dot carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Thu Jul 17 10:06:00 GMT 2008



------- Comment #2 from paolo dot carlini at oracle dot com  2008-07-17 10:06 -------
(In reply to comment #0)
>    int bit;
>    for( bit = 1; bit; bit *= 2 )

This is pretty straightforward, isn't it? At some point bit - a *signed*
integral type - overflows and this leads to undefined bahavior.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36862



More information about the Gcc-bugs mailing list