This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14639] New: Incorrect emission of unused compiler-generated destructor at -O2
- From: "austern at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Mar 2004 20:46:39 -0000
- Subject: [Bug c++/14639] New: Incorrect emission of unused compiler-generated destructor at -O2
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider the following file:
class AAA {
public:
virtual ~AAA();
};
class BBB {
public:
virtual ~BBB();
};
class xyz : public AAA, public BBB {
public:
xyz() : AAA(), BBB() { }
};
Class xyz has no key method, so its vtable should be emitted only in translation units where it's used.
With "gcc -O0 -c foo.cc" I get what I expect: the compiler doesn't emit _ZTV3xyz, _ZN3xyzD0Ev, or
anything else. With "gcc -O2 -c foo.cc" I get incorrect behavior: the compiler emits xyz's destructor
and vtable, thunks, and all of the things in AAA and BBB that are required to support them.
This is a regression. In 3.2.2, O0 and O2 both behave correctly.
--
Summary: Incorrect emission of unused compiler-generated
destructor at -O2
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: austern at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14639