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: [RFC] Detect most integer overflows.


On 10/30/2013 03:23 PM, David Brown wrote:
> I believe that's only a minor reason for making signed overflows
> undefined behaviour.  If it were a matter of implementation, I think it
> would have been made "implementation defined" rather than "undefined",
> so that two's complement machines could use wrapping while other systems
> (which are very rare now) could have other defined overflow behaviour.
> 
> The main reason (again, this is my guess - I don't know what the C
> standards folk /actually/ thought) is that there is no obvious "correct"
> behaviour for signed overflow

A more important reason that having signed overflow undefined allows
a lot of powerful loop optimization algorithms.

Andrew.


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