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: [PATCH] Document arithmetic overflow semantics


> > I'm prepared to drop this entire argument if you can find me just one
>
> The one I mentioned: (a*2)/2.


That'll do.  You're right, GCC does optimize this assuming undefined
overflow.  Good to my word, I hereby withdraw my patch.  There are
more bugs in this area, than I can hope to address.

Interestingly, Microsoft's Visual C/C++ compilers don't optimize this
example.  I wonder how much of their 20% SPECint advantage over mainline
GCC is from their use of two's-complement semantics vs. undefined
overflow.  For example, they also optimize "z1 = (x+y)+z; z2 = x+(y+z)"
which GCC currently can't.


What can I say.  I tried.  I failed.
My apologies for any inconvenience.

Roger
--


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