This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/11269] New: [tree-ssa] wrong-code
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jun 2003 18:33:20 -0000
- Subject: [Bug optimization/11269] New: [tree-ssa] wrong-code
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11269
Summary: [tree-ssa] wrong-code
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P1
Component: optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: reichelt@gcc.gnu.org
CC: dnovillo@gcc.gnu.org,gcc-bugs@gcc.gnu.org
GCC host triplet: i686-pc-linux-gnu
The following code snippet (inspired by PR6189) should return "1",
but does not, if optimization on the tree-ssa-branch is turned on.
---------------------------------------------------------------
struct A
{
int x[2];
int& GetFirst() { return x[0]; }
};
A foo ()
{
A a;
a.GetFirst()=1;
return a;
}
int main()
{
A b=foo();
return b.GetFirst();
}
---------------------------------------------------------------
Without optimization I get the return value "1", with "-O" or "-O2"
I get "192" and with "-O3" I get "0".
This is a regression w.r.t. mainline.