[BUG][GCC] *Serious* optimization bug: Any gcc specialists out there?

David Chase chase at world.std.com
Fri Aug 4 16:28:34 UTC 2000


At 04:31 PM 8/4/00 +0200, Stephan Rudlof wrote:
>the result strongly differs! (the optimized version gives the *wrong*
>result)

And those results were? :-)

I got identical behavior, in both cases printing:
sin(arg1): -6.452513e-01

Gcc version:
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)

Checking against two Java implementations:
-0.6452512852657808442058
(they both agreed, and if rounded to 7 decimal
digits, they agree with the C program)

Checking against contructive reals calculator:
-0.6452512852657808442058117113125230074069...
(agrees with Java, if rounded)

Lacking your results, I can suggest two possibilities:

1. your copy of gcc used an inline call to the native
   instruction, which might differ.

2. your copy of gcc evaluated the call to sin, incorrectly,
   at compile time (for instance, gcc itself might have
   the call inlined, though that seems a little unlikely).

If you compile with the "-S" flag, you can look at the
generated assembly language, and maybe see what happened
there.


David Chase
chase at world.std.com
drchase at alumni.rice.edu
chase at naturalbridge.com





More information about the Squeak-dev mailing list