DragonFly kernel List (threaded) for 2007-11
DragonFly BSD
DragonFly kernel List (threaded) for 2007-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: GCC-4 compiler bug


From: Daniel Tralamazza <tralamazza@xxxxxxxxx>
Date: Thu, 29 Nov 2007 02:45:27 +0100

Simon 'corecode' Schubert wrote:
Yea, it seems that GCC 4 started to exploit the C99 standard which says that signed integer overflows are undefined. This is a nasty thing and comes unexpected for many programmers and existing source.
I don't think this is new Simon, for example that program works fine
with gcc 4.0.1 on MacOS.


We have two choices here: "fix" code so that it doesn't rely on signed integer overflows or hack gcc so that it won't do this one particular optimization.
Signed arithmetic is tricky. Heck last time I checked abs(-2147483648)
was still returning -2147483648 :P


Now I would be inclined to say that gcc should behave, but on the other hand I can't really see applications to this *except for checking integer overflows in the first place*.


Opinions?

Does this code works correctly with -fwrapv ?


cheers,

Daniel



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