Mail Archives: djgpp-workers/1998/03/10/08:52:54
molnarl AT cdata DOT tvnet DOT hu wrote:
>Hi!
>
>I'm not sure whether it is a new bug. I've found it with the latest
>test version of perl.
>
>This program is a feature test for perl. Compile this with -O0 and it
>prints 0, but with -O2 it prints 1. This bug also appears on linux
>(2.7.2.3).
>
>And another interesting thing: when you compile this with 2.8.0 and
>-O2, gcc optimize out the whole test and the assembly is just an
>exit(1)! Wow!
>
>Laszlo
>
>ps: the original code doesn't have any printf
That's isn't considered as a bug by the gcc maintainers. Just compile like
that: -O2 -ffloat-store and you'll get 0.
The problem is because of the 80 bits registers used by the FPU, this extra
resolution produces different results than the expected. With -ffloat-store
you force to store the value in memory (64 bits for doubles I guess).
SET
------------------------------------ 0 --------------------------------
Visit my home page: http://set-soft.home.ml.org/
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013
- Raw text -