[BUG][!] Optimization bug in gcc! [was: Re: sinful bug]

Stephan Rudlof sr at evolgo.de
Fri Aug 4 01:44:16 UTC 2000


Stephan Rudlof wrote:
> 
> Dear Squeakers,
> 
> there seems to be an optimization bug in gcc, arising in interp.c for -O1
> already!
> 
> Example: Optimization for sin()'s is possible; program
> 
> #include <stdio.h>
> #include <math.h>
> 
> static void testDoubles () {
>   printf("\n_LIB_VERSION == _POSIX_: %d", _LIB_VERSION == _POSIX_);
>   { double arg1 = 1.0e20;
>   printf("\nsin(arg1): %e", sin(arg1));
>   }
>   _LIB_VERSION = _IEEE_;
>   printf("\n_LIB_VERSION == _IEEE_: %d", _LIB_VERSION == _IEEE_);
>   {
>     double arg2 = 1.0e20;
>     printf("\nsin(arg2): %e", sin(arg2));
>   }
> }
> 
> int main () {
>   testDoubles();
> }
> 
> works correctly with -O3. But the sin() called by primitiveSine() in
> interp.c not (works only with O0)!

Curiously the same code of testDoubles() doesn't work if compiled in
interp.c (called as test from primitiveSine() gives results 1.0e20), too!
Why?
I think it should despite of potential inlining problems!

Any ideas?

Stephan





More information about the Squeak-dev mailing list