This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/36862] Optimization O2 causes infinite loop
- From: "paolo dot carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jul 2008 10:06:03 -0000
- Subject: [Bug c/36862] Optimization O2 causes infinite loop
- References: <bug-36862-4575@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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