This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12751] [tree-ssa] wrong code: double destruction
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Oct 2003 22:33:57 -0000
- Subject: [Bug c++/12751] [tree-ssa] wrong code: double destruction
- References: <20031023234537.12751.stefaandr@hotmail.com>
- 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=12751
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Keywords| |wrong-code
Target Milestone|--- |tree-ssa
------- Additional Comments From bangerth at dealii dot org 2003-10-27 22:33 -------
Here's a small, self-contained, testcase:
--------------------
extern int printf (__const char *__restrict __format, ...) throw ();
struct Y {
Y() { printf("Y::Y\n");}
~Y() { printf("Y::~Y\n"); }
};
int main() {
Y y1;
Y y2;
switch(0) {
case 1:
{
Y y3;
return 0;
}
};
};
---------------------------
When compiled with tree-ssa, I get this as output:
g/x> /home/bangerth/bin/gcc-tree-ssa/bin/c++ y.cc && ./a.out
Y::Y
Y::Y
Y::~Y
Y::~Y
Y::~Y
That is, two constructor, and three destructor calls (and no copy constructors
in between). That's definitely wrong.
W.