[Bug c++/50115] Integer test optimised away at -O2 by the VRP
balint at szentedwg dot ro
gcc-bugzilla@gcc.gnu.org
Thu Aug 18 12:56:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50115
--- Comment #8 from Balint Szente <balint at szentedwg dot ro> 2011-08-18 12:44:53 UTC ---
Just for the record, for clarifying this for me and other people... There are
two statements in C++ standard:
* Chapter 5
"If during the evaluation of an expression, the result is not mathematically
defined or not in the range of representable values for its type, the behavior
is undefined."
* Section 3.9.1
"... unsigned arithmetic does not overflow because a result that cannot be
represented by the resulting unsigned integer type is reduced modulo the number
that is one greater than the largest value that an be represented by the
resulting unsigned integer type."
So if I understand correctly *signed integer* overflow is undefined and
*unsigned integer* overflow actually wraps around. Is this correct?
More information about the Gcc-bugs
mailing list