User account creation filtered due to spam.

Bug 10271 - [3.2/3.3/3.4 regression] [HPPA] Floating point args don't get reloaded across function calls at -O2
Summary: [3.2/3.3/3.4 regression] [HPPA] Floating point args don't get reloaded across...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3
: P3 normal
Target Milestone: 3.3
Assignee: John David Anglin
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2003-03-31 05:06 UTC by Randolph Chung
Modified: 2004-07-13 17:39 UTC (History)
1 user (show)

See Also:
Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
Build: hppa-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randolph Chung 2003-03-31 05:06:00 UTC
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.

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

        <machine, os, target, libraries (multiple lines)>
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

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 <stdio.h>
#include <math.h>

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;
}
Comment 1 John David Anglin 2003-04-12 21:47:57 UTC
Responsible-Changed-From-To: unassigned->danglin
Responsible-Changed-Why: Assignment.
Comment 2 John David Anglin 2003-04-12 21:47:57 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
    
    There is a problem with the usage notes for argument registers in sibling calls when an argument needs to be passed in both general and floating point registers.  The usage notes appear correct in the initial rtl but the note for the general general register for the third argument of the fprintf call is being dropped.  This causes the insns which load these argument registers to be deleted.
    
    Correct code is generated if the -fno-optimize-sibling-calls option is specified.  The first fprintf call behaves correctly because it isn't a sibling call.
    
    More analysis is needed to determine why usage notes are being dropped in sibling calls.
    
    This is a regression as sibcalls were first enabled on this port in 3.1 branch.
Comment 3 John David Anglin 2003-04-16 17:51:45 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed.
    <http://gcc.gnu.org/ml/gcc-patches/2003-04/msg01236.html>.