public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3936: g++
@ 2001-08-04  3:16 Matthias Klose
  0 siblings, 0 replies; 4+ messages in thread
From: Matthias Klose @ 2001-08-04  3:16 UTC (permalink / raw)
  To: gcc-gnats, debian-gcc

>Number:         3936
>Category:       c++
>Synopsis:       g++
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 04 03:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Ove Kaaven <ovek@arcticnet.no>
>Release:        3.0.1 (CVS 20010801) (Debian GNU/Linux)
>Organization:
The Debian project
>Environment:
System: Debian GNU/Linux (testing/unstable)
Architecture: sparc
	
host: sparc-linux
build: sparc-linux
target: sparc-linux
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc sparc-linux
>Description:
[ Reported to the Debian BTS as report #88694.
  Please CC 88694-quiet@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/88694 ]
 	

The compiler optimizes out the variable, which is OK without -g, but
with -g, the stabs debugging info explicitly references the
optimized-out variable, causing an undefined reference, and the
application (e.g. flightgear) will fail to link (seen on sparc-linux,
not i386-linux).

typedef double SCALAR;

typedef SCALAR VECTOR_3[3];

class LaRCsimIC {
public:
  SCALAR xlo, xhi,xmin,xmax;

  typedef SCALAR (LaRCsimIC::*fp)(SCALAR x);
  fp sfunc;

  bool solve( SCALAR *y,SCALAR x);
};

bool LaRCsimIC::solve( SCALAR *y,SCALAR x) {
  float x1,x2,x3,f1,f2,f3,d,d0;
  float eps=1E-5;
  float const relax =0.9;
  int i;
  bool success=false;

  d=1;
  
    x1=xlo;x3=xhi;
    f1=(this->*sfunc)(x1)-x;
    f3=(this->*sfunc)(x3)-x;
    d0=fabs(x3-x1);
  
    //iterations
    i=0;
    while ((fabs(d) > eps) && (i < 100)) {
      d=(x3-x1)/d0;
      x2=x1-d*d0*f1/(f3-f1);
      
      f2=(this->*sfunc)(x2)-x;

      if(fabs(f2) <= 0.001) {
        x1=x3=x2;
      } else if(f1*f2 <= 0.0) {
        x3=x2;
        f3=f2;
        f1=relax*f1;
      } else if(f2*f3 <= 0) {
        x1=x2;
        f1=f2;   
        f3=relax*f3;
      }
      i++;
    }//end while
    if(i < 100) {
      success=true;
      *y=x2;  
    }

  return success;
}

$ g++-3.0 -O2 -g -c bug.cc ; nm bug.o 
0000000000000000 a *ABS*
                 U .LLC0
00000000000002c8 t Letext
0000000000000000 T _ZN9LaRCsimIC5solveEPdd
0000000000000000 ? __FRAME_BEGIN__
                 U __gxx_personality_v0
                 U fabs

$ g++-3.0 -O2 -c bug.cc ; nm bug.o
0000000000000000 a *ABS*
0000000000000000 T _ZN9LaRCsimIC5solveEPdd
0000000000000000 ? __FRAME_BEGIN__
                 U __gxx_personality_v0
                 U fabs

>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/3936: g++
@ 2002-02-17 19:26 rodrigc
  0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2002-02-17 19:26 UTC (permalink / raw)
  To: 88694-quiet, gcc-bugs, gcc-prs, nobody, ovek

Synopsis: g++

State-Changed-From-To: feedback->closed
State-Changed-By: rodrigc
State-Changed-When: Sun Feb 17 19:26:34 2002
State-Changed-Why:
    No feedback.

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


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

* Re: c++/3936: g++
@ 2001-12-03  8:56 rodrigc
  0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2001-12-03  8:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/3936; it has been noted by GNATS.

From: rodrigc@gcc.gnu.org
To: 88694-quiet@bugs.debian.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
  gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, ovek@arcticnet.no
Cc:  
Subject: Re: c++/3936: g++
Date: 3 Dec 2001 16:47:54 -0000

 Synopsis: g++
 
 State-Changed-From-To: open->feedback
 State-Changed-By: rodrigc
 State-Changed-When: Mon Dec  3 08:47:54 2001
 State-Changed-Why:
     Is this fixed in gcc 3.0.2?
     What variable is being optimized out?
     If I compile your testcase on i386 Linux with:
     -O2
     or
     -O2 -g
     
     I get the same symbols:
     00000000 T LaRCsimIC::solve(double*, double)
              U __gxx_personality_v0
     
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=3936&database=gcc


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

* Re: c++/3936: g++
@ 2001-12-03  8:47 rodrigc
  0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2001-12-03  8:47 UTC (permalink / raw)
  To: 88694-quiet, gcc-bugs, gcc-gnats, gcc-prs, nobody, ovek

Synopsis: g++

State-Changed-From-To: open->feedback
State-Changed-By: rodrigc
State-Changed-When: Mon Dec  3 08:47:54 2001
State-Changed-Why:
    Is this fixed in gcc 3.0.2?
    What variable is being optimized out?
    If I compile your testcase on i386 Linux with:
    -O2
    or
    -O2 -g
    
    I get the same symbols:
    00000000 T LaRCsimIC::solve(double*, double)
             U __gxx_personality_v0
    

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


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

end of thread, other threads:[~2002-02-18  3:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-04  3:16 c++/3936: g++ Matthias Klose
2001-12-03  8:47 rodrigc
2001-12-03  8:56 rodrigc
2002-02-17 19:26 rodrigc

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