--- Comment #5 from frederic dot merizen at gmail dot com 2007-07-13 21:44
---
OK. I assumed signed overflow was at least defined to yield an integer (i.e. a
quantity that is consistently negative or non-negative) but that is actually
not specified. I don't quite know what I'll do with
--- Comment #4 from rguenth at gcc dot gnu dot org 2007-07-13 15:50 ---
Not if you test against (signed)R ;).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32757
--- Comment #3 from rask at sygehus dot dk 2007-07-13 15:40 ---
Well, if you declare R as unsigned, GCC will still optimize away "if (R<0)".
;-)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32757
--- Comment #2 from rguenth at gcc dot gnu dot org 2007-07-13 15:35 ---
Overflow of signed integers is undefined. Use an unsigned quantity for R.
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added
--
--- Comment #1 from rask at sygehus dot dk 2007-07-13 15:34 ---
I don't see how R can become negative:
R=0;
while (...)
{
...
R=R*5+[unsigned value here];
...
}
What am I missing?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32757