optimization/8635: incorrect optimization of 0.0 * Infinity
zlomek@gcc.gnu.org
zlomek@gcc.gnu.org
Thu Dec 5 00:32:00 GMT 2002
Synopsis: incorrect optimization of 0.0 * Infinity
State-Changed-From-To: open->closed
State-Changed-By: zlomek
State-Changed-When: Thu Dec 5 00:32:47 2002
State-Changed-Why:
When compiling with -O the variables are kept in coprocessor registers which are more exact that doubles (they are as exact as long doubles). Compiler is allowed to keep the values more exact. Although the value is infinite for doubles, it is finite for long doubles and thus 0.0 * (large but finite) = 0.
I also tried to make a long double infinite and it worked as expected: 0.0 * inf = nan
(the reason why the result with -O0 was nan is that the register was stored to memory as double and loaded again so when converting large number to doubles it became inf)
Josef Zlomek
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8635
More information about the Gcc-prs
mailing list