c++/7322: Code to Compute Numeric Limits "runs away" when -O<any> used
nathan@gcc.gnu.org
nathan@gcc.gnu.org
Tue Jul 16 01:44:00 GMT 2002
Synopsis: Code to Compute Numeric Limits "runs away" when -O<any> used
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Tue Jul 16 01:41:42 2002
State-Changed-Why:
The code is ill formed.
There are tests such as
if (T (max + 1) > max)
where max & T are signed types. [5]/5 says that
if the result is not in the range if representable values,
the behaviour is undefined. gcc implements modulo arithmetic
for unsigned types, and undefined behaviour for signed types.
The optimized therefore knows that max + 1 must always
be greater than max.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7322
More information about the Gcc-bugs
mailing list