------- Additional Comments From Thomas dot Koenig at online dot de 2004-12-27 10:26 ------- (In reply to comment #6) > Can you try just -funsafe-math-optimizations and see what happens I think you will get the same > results as "-ffast-math -fno-finite-math-only" as I think an instruction in the .md file checks the wrong > flag.
$ gcc -funsafe-math-optimizations nan-check2.c $ ./a.out nan compares equal to itself $ gcc -S -funsafe-math-optimizations nan-check2.c $ cat nan-check2.s .file "nan-check2.c" .section .rodata .LC1: .string "%f compares equal to itself\n" .align 4 .LC2: .string "%f compares unequal to itself\n" .text .globl main .type main, @function main: pushl %ebp movl %esp, %ebp subl $56, %esp andl $-16, %esp movl $0, %eax addl $15, %eax addl $15, %eax shrl $4, %eax sall $4, %eax subl %eax, %esp fldz fstpl -16(%ebp) fldz fstpl -8(%ebp) fldl -16(%ebp) fdivl -8(%ebp) fstpl -24(%ebp) leal -24(%ebp), %eax movl %eax, 4(%esp) leal -24(%ebp), %eax movl %eax, (%esp) call equality testl %eax, %eax je .L2 fldl -24(%ebp) fstpl 4(%esp) movl $.LC1, (%esp) call printf jmp .L4 .L2: fldl -24(%ebp) fstpl 4(%esp) movl $.LC2, (%esp) call printf .L4: movl $0, %eax leave ret .size main, .-main .globl equality .type equality, @function equality: pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax fldl (%eax) movl 12(%ebp), %eax fldl (%eax) fcompp fnstsw %ax sahf sete %al movzbl %al, %eax popl %ebp ret .size equality, .-equality .ident "GCC: (GNU) 4.0.0 20041224 (experimental)" .section .note.GNU-stack,"",@progbits $ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116