This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/27115] [4.0/4.1/4.2 Regression] ICE in cp_expr_size or miscompilation
- 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: 12 Apr 2006 12:11:01 -0000
- Subject: [Bug c++/27115] [4.0/4.1/4.2 Regression] ICE in cp_expr_size or miscompilation
- References: <bug-27115-87@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from reichelt at gcc dot gnu dot org 2006-04-12 12:11 -------
Here's a shorter testcase for the wrong-code problem (using "-O"):
It should return 0, but returns something else since GCC 4.0.2.
The compiler crashes on this testcase with GCC 3.3 - 4.0.1.
=========================================================
struct A
{
int i;
A (int j) : i(j) {}
A (const A &j) : i(j.i) {}
A& operator= (const A &j) { i = j.i; return *this; }
};
A foo(int j)
{
return ({ j ? A(1) : A(0); });
}
int main()
{
return foo(1).i-1;
}
=========================================================
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27115