From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26422 invoked by alias); 29 Mar 2002 00:16:05 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 26360 invoked by uid 71); 29 Mar 2002 00:16:03 -0000 Resent-Date: 29 Mar 2002 00:16:02 -0000 Resent-Message-ID: <20020329001602.26359.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, snyder@fnal.gov Received:(qmail 25660 invoked from network); 29 Mar 2002 00:13:06 -0000 Received: from unknown (HELO karma.fnal.gov) (131.225.227.40) by sources.redhat.com with SMTP; 29 Mar 2002 00:13:06 -0000 Received: (from sss@localhost) by karma.fnal.gov (8.11.6/8.11.6) id g2T08t305925; Thu, 28 Mar 2002 18:08:55 -0600 Message-Id:<200203290008.g2T08t305925@karma.fnal.gov> Date: Thu, 28 Mar 2002 16:16:00 -0000 From: snyder@fnal.gov Reply-To: snyder@fnal.gov To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:3.113 Subject: target/6087: 3.1 i86 FP stack pop bug X-SW-Source: 2002-03/txt/msg01115.txt.bz2 List-Id: >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: