http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58678

            Bug ID: 58678
           Summary: [4.9 Regression] pykde4-4.11.2 link error
                    (devirtualization too trigger happy)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markus at trippelsdorf dot de

pykde4-4.11.2 fails to build:

CMakeFiles/python_module_PyKDE4_phonon.dir/sip/phonon/sipphononpart5.cpp.o:sipphononpart5.cpp:function
release_Phonon_BackendCapabilities_Notifier: error: undefined reference to
'vtable for Phonon::BackendCapabilities::Notifier'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/../../../../x86_64-pc-linux-gnu/bin/ld:
the vtable symbol may be undefined because the class is missing its key
function
CMakeFiles/python_module_PyKDE4_phonon.dir/sip/phonon/sipphononpart5.cpp.o:sipphononpart5.cpp:function
Phonon::BackendCapabilities::Notifier::~Notifier(): error: undefined reference
to 'vtable for Phonon::BackendCapabilities::Notifier'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/../../../../x86_64-pc-linux-gnu/bin/ld:
the vtable symbol may be undefined because the class is missing its key
function
CMakeFiles/python_module_PyKDE4_phonon.dir/sip/phonon/sipphononpart5.cpp.o:sipphononpart5.cpp:function
Phonon::BackendCapabilities::Notifier::~Notifier(): error: undefined reference
to 'vtable for Phonon::BackendCapabilities::Notifier'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/../../../../x86_64-pc-linux-gnu/bin/ld:
the vtable symbol may be undefined because the class is missing its key
function
collect2: error: ld returned 1 exit status

Reduced:

markus@x4 tmp % cat test.ii
class A {
public:
  virtual ~A();
};
class B : A {
  virtual int m_fn1();
};
void fn1() {
  delete reinterpret_cast<B*>(1);
}

markus@x4 tmp % g++ -O1 -c test.ii
markus@x4 tmp % nm test.o | c++filt
0000000000000000 T fn1()

markus@x4 tmp % g++ -O2 -c test.ii
markus@x4 tmp % nm test.o | c++filt
0000000000000000 T fn1()
                 U operator delete(void*)
                 U A::~A()
0000000000000000 W B::~B()
0000000000000000 W B::~B()
0000000000000000 W B::~B()
0000000000000000 n B::~B()
                 U vtable for B

markus@x4 tmp % clang++ -O2 -c test.ii
markus@x4 tmp % nm test.o | c++filt
0000000000000000 T fn1()
markus@x4 tmp % 

Started with r202145.

Reply via email to