Return-Path: Received: from sources.redhat.com (sources.redhat.com [66.187.233.205]) by dsl2.external.hp.com (Postfix) with SMTP id 253D94829 for ; Sun, 30 Mar 2003 22:05:41 -0700 (MST) Date: 31 Mar 2003 05:05:40 -0000 Message-ID: <20030331050540.17826.qmail@sources.redhat.com> To: gcc-gnats@gcc.gnu.org Cc: parisc-linux@lists.parisc-linux.org From: Randolph Chung Reply-To: Randolph Chung Subject: [parisc-linux] [3.0/3.2/3.3/3.4] [HPPA] Floating point args don't get reloaded across function calls at -O2 Sender: parisc-linux-admin@lists.parisc-linux.org Errors-To: parisc-linux-admin@lists.parisc-linux.org List-Help: List-Post: List-Subscribe: , List-Id: parisc-linux developers list List-Unsubscribe: , List-Archive: >Category: target >Synopsis: [3.0/3.2/3.3/3.4] [HPPA] Floating point args don't get reloaded across function calls at -O2 >Confidential: no >Severity: serious >Priority: medium >Class: wrong-code >Submitter-Id: net >Originator: Randolph Chung >Release: 3.3 20030309 (Debian prerelease) (Debian testing/unstable) [and others] >Environment: System: Linux gsyprf11.external.hp.com 2.4.20-pa18-UP #1 Sat Jan 4 22:06:52 PST 2 003 parisc64 unknown unknown GNU/Linux Architecture: parisc64 host: hppa-unknown-linux-gnu build: hppa-unknown-linux-gnu target: hppa-unknown-linux-gnu configured with: ../src/configure -v --enable-languages=c,c++,f77,objc,ada,treela ng --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-inc lude-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --w ithout-included-gettext --enable-__cxa_atexit --enable-sjlj-exceptions --enable-c locale=gnu --enable-debug --enable-objc-gc hppa-linux >Description: When compiling the bug.c code below with -O2, the floating point argument to the fprintf does not get reloaded for the second fprintf() call, so the second call prints junk. At -O1 the arguments (r23/r24) are properly reloaded. >How-To-Repeat: Compile with gcc -O2 -o bug bug.c -lm $ ./bug nan 1.422968e-309 With -O1 $ ./bug nan nan ------8< bug.c 8<-------- #include #include void doprint(double dval) { fprintf(stdout, "%e\n", dval); fprintf(stdout, "%e\n", dval); } int main(int argc, char **argv) { doprint(log(-8)); /* nan */ return 0; } >Fix: >Unformatted: