optimization/8959: gcc-2.95/3.2 add/subtract results are wrong for a short time when optimising on x86
ehrhardt@mathematik.uni-ulm.de
ehrhardt@mathematik.uni-ulm.de
Mon Dec 16 06:54:00 GMT 2002
Synopsis: gcc-2.95/3.2 add/subtract results are wrong for a short time when optimising on x86
State-Changed-From-To: open->closed
State-Changed-By: cae
State-Changed-When: Mon Dec 16 06:53:21 2002
State-Changed-Why:
You cannot reliably use == with float values not even in your case.
Most likely what happens is that the first comparison compares a
saved value of sum1 with the value computed for sum2 that is still
in some register. As registers have higher precision than memory values
(i.e. storing a float/double value to memory truncates the value)
the precision of sum2 is higher than that of sum1, consequently the
values are different. The first call to just_that will force the compiler
to write sum2 to memory and truncate the value along the way. Thus the
result of the second comparison is true because both values were stored
and truncated.
regards Christian
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8959
More information about the Gcc-bugs
mailing list