[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: MIT discovered issue with gcc



On Tue Nov 26, 2013 at 14:37:18, Mark Haase wrote:
> Miles, the GCC developers don't consider this to be a bug, and so I doubt
> that any of it will be "fixed". For example, here is a "bug" cited in the
> paper:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475
> 
> If you have a moment, read through that thread. It gets pretty testy as the
> developers argue over whether or not it's a bug. Eventually it was closed
> as "invalid', i.e. not really a true bug. It's not just GCC, either. Take a
> look at this series of blog posts by the LLVM team:
> 
> http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html
> 
> Compiler developers, for better or worse, reserve the right to do whatever
> they want with undefined behavior, and it's up to the person writing the C
> code to not include undefined behavior in their own program.

Not that I want to argue in favor of the testy behavior and I know there's
plenty of code out there that makes false assumptions about signed integer
overflow and hence relies on undefined behavior when checking for
overflow, but I can also see the point of the compiler developers here.
Such code has never been valid and any assumption anyone may falsely have
on such code is outright wrong. Such code may do anything, which includes
nothing so IMHO it's perfectly ok for the optimizer to throw it away.
After all we'd be better of not relying on something that is "undefined".

Regards,
 Stefan


Reply to: