This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/8635: incorrect optimization of 0.0 * Infinity
- From: zlomek at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, petdr at cs dot mu dot OZ dot AU
- Date: 5 Dec 2002 08:32:54 -0000
- Subject: Re: optimization/8635: incorrect optimization of 0.0 * Infinity
- Reply-to: zlomek at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, petdr at cs dot mu dot OZ dot AU, gcc-gnats at gcc dot gnu dot org
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