Since when does GCC *assume* the program to be correct?
Posted Apr 17, 2008 20:39 UTC (Thu) by brouhaha
In reply to: Since when does GCC *assume* the program to be correct?
Parent article: GCC and pointer overflows
My point exactly. If the assumption is only that the program is written in C, but NOT that it is a correct C program, then it isn't reasonable to assume that the program's use of pointers meets the constraint defined by the standard, in which a pointer will never be manipulated to point outside its object.
That would be a fine optimization to use when you choose some high level of optimization that includes unsafe optimizations, but it shouldn't happen at -O1.
to post comments)