[Bug lto/42009] New: LTO unable to link in presence of multiple inheritance

View: New views
5 Messages — Rating Filter:   Alert me  

[Bug lto/42009] New: LTO unable to link in presence of multiple inheritance

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The C++ testcase that I am about to attach compiles and links well
without LTO at all optimizations levels.  Unfortunately, whenever I
try to compile it with LTO (at any optimization level including zero),
I get the following link error:

mjambor@host:~/gcc/fail$ ~/gcc/inst/trunk/bin/g++ -flto testcase.cpp
/tmp/ccxMi1Vq.lto.o:(.rodata._ZTV1B[_ZTV1B]+0x18): undefined reference to
`_ZThn16_N1B3fooEi'
collect2: ld returned 1 exit status

When I remove the first ancestor of class B from the list of
ancestors, the testcase links and works fine.

I get a very similar error on x86_64 too.  On both machines the used
compiler is pristine trunk revision 154038.


--
           Summary: LTO unable to link in presence of multiple inheritance
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jamborm 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=42009


[Bug lto/42009] LTO unable to link in presence of multiple inheritance

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #1 from jamborm at gcc dot gnu dot org  2009-11-11 14:40 -------
Created an attachment (id=19004)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19004&action=view)
Testcase

This is the testcase.


--


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


[Bug lto/42009] LTO unable to link in presence of multiple inheritance

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #2 from wouter dot vermaelen at scarlet dot be  2009-11-11 18:26 -------
I (independently) found the same issue today.

I managed to reduce it to the following testcase:

> cat foo.cc
struct Base1 { virtual ~Base1(); };
struct Base2 { virtual ~Base2(); };
struct Foo : Base1, Base2 { virtual ~Foo(); };
Base1::~Base1() {}
Base2::~Base2() {}
Foo::~Foo() {}
int main() { return 0; }

> g++ foo.cc
[works fine]

> g++ -flto foo.cc
/usr/bin/ld: /tmp/ccNr43fh.lto.o: in function
_ZTV3Foo:ccuOnB3i.o(.gnu.linkonce.r._ZTV3Foo+0x30): error: undefined reference
to '_ZThn8_N3FooD1Ev'
/usr/bin/ld: /tmp/ccNr43fh.lto.o: in function
_ZTV3Foo:ccuOnB3i.o(.gnu.linkonce.r._ZTV3Foo+0x38): error: undefined reference
to '_ZThn8_N3FooD0Ev'
collect2: ld returned 1 exit status


--

wouter dot vermaelen at scarlet dot be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wouter dot vermaelen at
                   |                            |scarlet dot be


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


[Bug lto/42009] LTO unable to link in presence of multiple inheritance

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-11-11 18:27 -------
Yes this is a known issue, thunks are not implemented.  I thought there was a
bug about this already too.


--

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


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


[Bug lto/42009] LTO unable to link in presence of multiple inheritance

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-11-11 18:28 -------
This is a dup of bug 37352 which is about thunks not working.

*** This bug has been marked as a duplicate of 37352 ***


--

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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