public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/6189: Regression from 3.0.x: g++ -O3 generates wrong code
@ 2002-04-05  7:56 reichelt
  0 siblings, 0 replies; 4+ messages in thread
From: reichelt @ 2002-04-05  7:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6189
>Category:       optimization
>Synopsis:       Regression from 3.0.x: g++ -O3 generates wrong code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 05 07:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Volker Reichelt
>Release:        gcc version 3.1 20020325 (prerelease)
>Organization:
>Environment:
i686-pc-linux-gnu, mips-sgi-irix6.5
>Description:
The following small C++-program should return 1,
but compiling the code with "g++ -O3" I get 0 as a result.

----------------------------snip here---------------------
class A
{
  private:
    int x[2];

  public:
    int& GetFirst() { return x[0]; }
};


A foo ()
{ 
    A a;
    a.GetFirst()=1;
    return a;
}


int main()
{
    A b=foo();
    return b.GetFirst();
}
----------------------------snip here---------------------

With less optimization the problem disappears.
It even disappears when I replace "private" by "public".

The bug is a regression from gcc 3.0.x.
>How-To-Repeat:
g++ -O3 bug.cpp; a.out; echo $?
>Fix:

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


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

* Re: optimization/6189: Regression from 3.0.x: g++ -O3 generates wrong code
@ 2002-10-28 13:22 reichelt
  0 siblings, 0 replies; 4+ messages in thread
From: reichelt @ 2002-10-28 13:22 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, reichelt

Synopsis: Regression from 3.0.x: g++ -O3 generates wrong code

State-Changed-From-To: open->closed
State-Changed-By: reichelt
State-Changed-When: Mon Oct 28 13:22:20 2002
State-Changed-Why:
    Fixed.

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


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

* Re: optimization/6189: Regression from 3.0.x: g++ -O3 generates wrong code
@ 2002-06-10  7:16 Jason Merrill
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2002-06-10  7:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/6189; it has been noted by GNATS.

From: Jason Merrill <jason@redhat.com>
To: Reichelt <reichelt@igpm.rwth-aachen.de>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: optimization/6189: Regression from 3.0.x: g++ -O3 generates
 wrong code
Date: Mon, 10 Jun 2002 15:06:07 +0100

 >>>>> "Reichelt" == Reichelt  <reichelt@igpm.rwth-aachen.de> writes:
 
 > Is there any reason why you did not close the PR? The problem seems to
 > be fixed in gcc 3.1 as well as in mainline (gcc 3.2 20020610).
 
 Because I thought we might want to fix it in a hypothetical 3.0.5 release.
 
 Jason


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

* Re: optimization/6189: Regression from 3.0.x: g++ -O3 generates wrong code
@ 2002-06-10  5:56 Reichelt
  0 siblings, 0 replies; 4+ messages in thread
From: Reichelt @ 2002-06-10  5:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/6189; it has been noted by GNATS.

From: Reichelt <reichelt@igpm.rwth-aachen.de>
To: jason@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/6189: Regression from 3.0.x: g++ -O3 generates wrong code
Date: Mon, 10 Jun 2002 15:25:24 +0200

 Hi Jason,
 
 thanks for fixing the bug.
 
 Is there any reason why you did not close the PR? The problem seems to
 be fixed in gcc 3.1 as well as in mainline (gcc 3.2 20020610).
 
 By the way, the link for the new testcase
   http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/nrv3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 doesn't work (at least not for me). However, the following works fine:
   http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/nrv3.C?rev=1.1
 Could you please update it?
 
 Greetings,
 Volker Reichelt
 
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6189
 
 


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

end of thread, other threads:[~2002-10-28 21:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-05  7:56 optimization/6189: Regression from 3.0.x: g++ -O3 generates wrong code reichelt
2002-06-10  5:56 Reichelt
2002-06-10  7:16 Jason Merrill
2002-10-28 13:22 reichelt

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