This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/9651: [Alpha] FPE with NAN in spite of isnan protection
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: gcc-gnats at gcc dot gnu dot org
- Date: Tue, 11 Feb 2003 01:29:17 +0100
- Subject: optimization/9651: [Alpha] FPE with NAN in spite of isnan protection
>Number: 9651
>Category: optimization
>Synopsis: [Alpha] FPE with NAN in spite of isnan protection
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Tue Feb 11 00:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Falk Hueffner
>Release: 3.4 20030203 (experimental)
>Organization:
>Environment:
System: Linux juist 2.5.59 #4 Sat Jan 18 12:46:41 CET 2003 alpha unknown unknown GNU/Linux
Architecture: alpha
host: alphaev68-unknown-linux-gnu
build: alphaev68-unknown-linux-gnu
target: alphaev68-unknown-linux-gnu
configured with: ../configure --disable-nls --enable-languags=c++ --with-gcc-version-trigger=/src/gcc-2003.02.03/gcc/version.c --no-create --no-recursion : (reconfigured) ../configure --disable-nls --enable-languages=c++
>Description:
% cat test.cc
#include <math.h>
double f(void);
int foo() {
double d = f();
if (isnan(d) || (d != (int) d))
d = 0;
return (int) d;
}
double f(void) { return NAN; }
int main() { return foo(); }
% g++ -O2 -mcpu=ev4 test.cc && ./a.out
zsh: floating point exception (core dumped) ./a.out
It looks like a cvttq/c was dragged out of the second condition:
[...]
.prologue 1
jsr $26,($27),_Z1fv !lituse_jsr!4
ldah $29,0($26) !gpdisp!5
lda $29,0($29) !gpdisp!5
cpys $f0,$f0,$f2
cpys $f0,$f0,$f16
ldq $27,__isnan($29) !literal!2
jsr $26,($27),__isnan !lituse_jsr!2
ldah $29,0($26) !gpdisp!3
lda $29,0($29) !gpdisp!3
-> cvttq/c $f2,$f10
stt $f10,16($30)
cpys $f31,$f31,$f31
ldq $1,16($30)
bne $0,$L3
>How-To-Repeat:
>Fix:
-fno-sched-interblock works around it.
>Release-Note:
>Audit-Trail:
>Unformatted: