This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19817] New: C++ front-end produces a cast instead of just &a.b (when call the deconstructor)
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Feb 2005 05:46:46 -0000
- Subject: [Bug c++/19817] New: C++ front-end produces a cast instead of just &a.b (when call the deconstructor)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code should be optimizated out on the tree level but is not because we have a cast
involved when calling the deconstuctor.
int t;
struct base { int i; ~base(){t = i;}};
struct vector : public base { vector(){ i = 2; }};
int f() { vector v; return t;}
extern "C" void abort ();
int main(void)
{
t = 2;
if (f() != 2)
link_error ();
if (t!= 2)
link_error ();
return 0;
}
This might be the case for PR 19786 but I don't know for sure.
--
Summary: C++ front-end produces a cast instead of just &a.b (when
call the deconstructor)
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: missed-optimization, TREE
Severity: enhancement
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19817