This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/19116] -fno-finite-math-only does not override -ffast-math
- From: "Thomas dot Koenig at online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Dec 2004 14:32:19 -0000
- Subject: [Bug middle-end/19116] -fno-finite-math-only does not override -ffast-math
- References: <20041221203640.19116.Thomas.Koenig@online.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From Thomas dot Koenig at online dot de 2004-12-25 14:32 -------
I find strange that the C equivalent does not
compare an NaN equal to itself, even with
-O3 -ffast-math :
$ cat nan-check.c
#include <stdio.h>
#include <math.h>
int equality(double a, double b);
int main()
{
double a, b, c;
a = 0.0;
b = 0.0;
c = a/b;
if (equality(c,c)) {
printf("%f compares equal to itself\n",c);
}
else {
printf("%f compares unequal to itself\n",c);
}
return 0;
}
int equality(double a, double b)
{
return a==b;
}
$ gcc -O3 -ffast-math nan-check.c
$ ./a.out
nan compares unequal to itself
$ gcc -v
Using built-in specs.
Configured with: ../gcc/configure --prefix=/home/ig25 --enable-languages=c,c++,f95
Thread model: posix
gcc version 4.0.0 20041224 (experimental)
... with i686-pc-linux-gnu.
Maybe the Fortran frontend does something different with FP
comparisons.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116