x86 regression: optimizer bug in 1.1 and dev

Horst von Brand vonbrand@sleipnir.valparaiso.cl
Mon Nov 9 19:12:00 GMT 1998


Mumit Khan <khan@xraylith.wisc.edu> said:
> Versions affected: 1.1 and development snapshots. REGRESSION from 1.0.3.
> 
> The following optimizer bug shows up on i686-pc-linux-gnu, i386-*win32 
> (and possibly other x86) ports when using -Ox, x >= 2.
> 
> Thanks to Peter Kabal <Kabal@ece.mcgill.ca> for the report and attached 
> testcase.
> 
> To reproduce on i686-pc-linux-gnu:
>   
>   $ gcc -O2 -D__NO_MATH_INLINES -o floor-bug floor-bug.c
>   $ ./floor-bug
>   AV = 20, AV - floor(AV) = -1.11022e-15
>                             ^^^^^^^^^^^^ should always be >= 0
> 
> Note that -D__NO_MATH_INLINES is necessary to reproduce the bug on glibc2.

This is i586, egcs-1.1, linux-2.1.127arca12, binutils-2.9.1.0.15,
glibc-2.0.100

I see the exact same result here, but I had to add -lm to link in the math
library.  You sure it's not a glibc bug (no -D__NO_MATH_INLINES gives:

AV = 20, AV - floor(AV) = 1

and libm is _not_ used). 
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viña del Mar, Chile                               +56 32 672616



More information about the Gcc-bugs mailing list