------- 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