This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Integer Overflow/Wrap and GCC Optimizations


On 1/24/2013 10:02 AM, Jeffrey Walton wrote:

What I am not clear about is when an operation is deemed "undefined"
or "implementation defined".

The compiler is free to assume that no arithmetic operation on signed integers results in overflow. It is allowed to take advantage of such assumptions in generating code (and it does so).

You have no right to assume *anything* about the semantics
of code that has an integer overflow (let alone make
asssumptions about the generated code).

This is truly undefined, not implementation defined, and
if your program has such an overflow, you cannot assume
ANYTHING about the generated code.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]