[Bug lto/53831] Inline virtuals missing in LTO symtab

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 3 12:40:00 GMT 2012


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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rafael.espindola at gmail
                   |                            |dot com
      Known to fail|                            |4.8.0

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-03 12:39:46 UTC ---
Heh, not sure ;)  Btw, the issue reproduces on trunk as well.  And if I use
-fno-fat-lto-objects I get a maybe more easily to debug linker failure:

repro> make USE_LTO=1
/space/rguenther/install/gcc-4.7.1/bin/g++ -B /abuild/rguenther/trunk-g/gcc -c
main.cpp -o main.o -ffunction-sections -funwind-tables -O2 -DNDEBUG
-fno-exceptions -fno-rtti -fno-fat-lto-objects -flto
In file included from main.cpp:1:0:
common.h:8:22: warning: inline function 'virtual void C::f()' used but never
defined [enabled by default]
  inline virtual void f();
                      ^
/space/rguenther/install/gcc-4.7.1/bin/g++ -B /abuild/rguenther/trunk-g/gcc -c
impl.cpp -o impl.o -ffunction-sections -funwind-tables -O2 -DNDEBUG
-fno-exceptions -fno-rtti -fno-fat-lto-objects -flto
ar rcs libdummy.a impl.o
/space/rguenther/install/gcc-4.7.1/bin/g++ -B /abuild/rguenther/trunk-g/gcc
main.o libdummy.a -o test.exe  -flto
/tmp/ccXwNVS0.ltrans0.ltrans.o: In function `main':
ccXwNVS0.ltrans0.o:(.text+0xc): undefined reference to `vtable for C'
ccXwNVS0.ltrans0.o:(.text+0x18): undefined reference to `C::f()'
ccXwNVS0.ltrans0.o:(.text+0x24): undefined reference to `C::g()'
collect2: error: ld returned 1 exit status
make: *** [test.exe] Error 1

note the warning about C::f() being never defined.  That leaves the vtable
for C in main.o with a reference to an external function - not sure if
that's valid from the ABI point of view (or if this is valid C++).

Might also be related to PR53808.



More information about the Gcc-bugs mailing list