This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/36124] conditional loop becomes infinite loop in -O2 (gcc 4.2 -> 4.3 regression)
- From: "scottwood at freescale dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 May 2008 21:13:56 -0000
- Subject: [Bug middle-end/36124] conditional loop becomes infinite loop in -O2 (gcc 4.2 -> 4.3 regression)
- References: <bug-36124-16149@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from scottwood at freescale dot com 2008-05-13 21:13 -------
(In reply to comment #4)
> If your code invokes undefined behavior, how is gcc going
> to read your mind?
If GCC can tell that it is undefined behavior, then warning the user is more
useful than silently producing nasal demons, regardless of what might be in the
user's mind. "The spec allows us to do something stupid" doesn't mean "we
should do something stupid".
> Maybe the programmer meant to enter
> an infinite, so a warning isn't correct.
If it's undefined behavior, then too bad, right? I have a really hard time
seeing how one would derive such intent from the above code, though -- or
imagining what GCC is doing that made it think that generating the code it does
is a good idea.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36124