public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: target/6087: 3.1 i86 FP stack pop bug
@ 2002-03-28 22:23 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-03-28 22:23 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, rth, snyder

Synopsis: 3.1 i86 FP stack pop bug

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Thu Mar 28 22:23:34 2002
State-Changed-Why:
    http://gcc.gnu.org/ml/gcc-patches/2002-03/msg01942.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6087


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: target/6087: 3.1 i86 FP stack pop bug
@ 2002-03-28 19:41 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-03-28 19:41 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rth, snyder

Synopsis: 3.1 i86 FP stack pop bug

Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Thu Mar 28 19:41:20 2002
Responsible-Changed-Why:
    .

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6087


^ permalink raw reply	[flat|nested] 3+ messages in thread

* target/6087: 3.1 i86 FP stack pop bug
@ 2002-03-28 16:16 snyder
  0 siblings, 0 replies; 3+ messages in thread
From: snyder @ 2002-03-28 16:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6087
>Category:       target
>Synopsis:       3.1 i86 FP stack pop bug
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 28 16:16:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     scott snyder
>Release:        3.1 20020326 (prerelease)
>Organization:
>Environment:
System: Linux karma 2.4.9-13 #1 Tue Oct 30 20:11:04 EST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77
>Description:

The code below executes incorrectly.
Here's what i get:

$ g++ -O0 -o x x.cc y.cc
$ ./x
25.000000
25.000000
25.000000
25.000000
nan
nan

What's happening is that the CftRibbon() constructor
is not properly popping the result of foobar5() off the FP stack.
The stack eventually fills up, and we start getting nan's resulting
from FP operations.

Here's the generated code for the call to foobar5():

.LEHB0:
        call    _Z7foobar5v
.LEHE0:
        fld     %st(0)
        jmp     .L1


Instead of popping the returned value, this duplicates it.


>How-To-Repeat:

Compile and link together these two sources.

-- x.cc ----------------------------------------------------------
struct d0om_Registerable
{
  virtual ~d0om_Registerable () {}
};

struct CftRibbon : public d0om_Registerable
{
  CftRibbon ();
};
 
double foobar5 ();

CftRibbon::CftRibbon ()
{
  foobar5();
}


int main ()
{
  new CftRibbon;
  new CftRibbon;
  new CftRibbon;
  new CftRibbon;
  new CftRibbon;
  new CftRibbon;
  return 0;
}
-- y.cc ----------------------------------------------------------
extern "C" int printf(...);
double x = 3;
double y = 4;
double foobar5 ()
{
  double z = x*x+y*y;
  printf ("%lf\n", z);
  return z;
}

------------------------------------------------------------------

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-03-29  6:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-28 22:23 target/6087: 3.1 i86 FP stack pop bug rth
  -- strict thread matches above, loose matches on Subject: below --
2002-03-28 19:41 rth
2002-03-28 16:16 snyder

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).