On Thu, Mar 19, 2009 at 05:22:11PM +1100, Erik de Castro Lopo wrote:
> 
> The following test case shows the failure when compiling with -ffast-math
> gives a different result than when compiling with out it.
> 
> More explanation in the comments at the top of the file.
> 
> Cheers,
> Erik
> 
> /*
> **    This file is in the Public Domain.
> **
> **    This program demonstrates a bug in the -ffast-math option of the gcc
> **    armel compiler : gcc version 4.3.2 (Debian 4.3.2-1.1) 
> **
> **    This works as expected:
> **
> **    > gcc -Wall -O3 gcc-test.c -o gcc-test && ./gcc-test 
> **    min :       0.0000    max :       0.0000
> **
> **    Compile with -ffast-math and things goes screwy.
> **
> **    > gcc -Wall -O3 -ffast-math gcc-test.c -o gcc-test && ./gcc-test 
> **    min :   99999.0000    max :       0.0000
> */

I get the following results:
(sid)kroe...@agricola:~$ gcc -O1 -ffinite-math-only tst.c -o tst
(sid)kroe...@agricola:~$ ./tst
min :   99999.0000    max :  -99999.0000
(sid)kroe...@agricola:~$ gcc -O3 -ffinite-math-only tst.c -o tst
(sid)kroe...@agricola:~$ ./tst
min :   99999.0000    max :       0.0000

With gcc version 4.3.3 (Debian 4.3.3-5)

agricola is an armel running on a Thecus N2100:
Processor       : XScale-80219 rev 0 (v5l)
BogoMIPS        : 593.10
Features        : swp half thumb fastmult edsp
CPU implementer : 0x69
CPU architecture: 5TE
CPU variant     : 0x0
CPU part        : 0x2e3
CPU revision    : 0

I've also tried this on ia64, hppa, mips, mipsel and arm, they all
gave the expected output.

I will clone this bug to gcc and file a bug upstream.


Kurt




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to