--- Comment #5 from ismail at pardus dot org dot tr 2007-12-13 20:48
---
Guido agreed on using -fwrapv hence a patch submitted, thanks for the
diagnosis.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34454
--- Comment #4 from ian at airs dot com 2007-12-13 20:37 ---
Note that this gives a warning with -Wstrict-overflow.
And note that you get the desired behaviour if you compile with
-fno-strict-overflow.
As Pinski says, the code is simply incorrect according to standard C, but you
can us
--- Comment #3 from ismail at pardus dot org dot tr 2007-12-13 19:37
---
FWIW this triggers a crash in Python 2.5, see http://bugs.python.org/issue1608
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34454
--- Comment #2 from pinskia at gcc dot gnu dot org 2007-12-13 19:37 ---
Or use unsigned types to do the addition.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34454
--- Comment #1 from pinskia at gcc dot gnu dot org 2007-12-13 19:36 ---
This is not a bug, signed overflow is undefined so optimizing away this case is
correct as a positive + positive is always positive.
Use -fwarpv or what ever the strict overflow option is.
--
pinskia at gcc dot