public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: gcc-gnats@gcc.gnu.org
Subject: optimization/9651: [Alpha] FPE with NAN in spite of isnan protection
Date: Tue, 11 Feb 2003 00:36:00 -0000	[thread overview]
Message-ID: <E18iOIX-0003dP-00@juist> (raw)


>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:


             reply	other threads:[~2003-02-11  0:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-11  0:36 Falk Hueffner [this message]
2003-02-11  2:56 Falk Hueffner
2003-02-11 20:56 Richard Henderson
2003-02-11 20:59 rth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E18iOIX-0003dP-00@juist \
    --to=falk.hueffner@student.uni-tuebingen.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).