This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14639] New: Incorrect emission of unused compiler-generated destructor at -O2


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]