Hi!

As Honza has determined, the problem on this testcase is that
forced_by_abi flag wasn't propagated from thunk's target to the thunk
(in this case the thunk's target was forced_by_abi = true, while the
thunk mistakenly didn't have that flag set).
The following patch copies that flag in the C++ FE, another alternative
is to do that in cgraph_add_thunk function (apparently only called by
use_thunk, thus practically the same spot, or it can be done in
function_and_variable_visibility.

I've bootstrapped/regtested this version on x86_64-linux and i686-linux,
ok for trunk?

2014-04-10  Jan Hubicka  <hubi...@ucw.cz>
            Jakub Jelinek  <ja...@redhat.com>

        PR lto/60567
        * method.c (use_thunk): Copy forced_by_abi flag from funcn to
        thunk_node.

        * g++.dg/lto/pr60567_0.C: New test.

--- gcc/cp/method.c.jj  2014-03-27 08:06:11.000000000 +0100
+++ gcc/cp/method.c     2014-04-10 12:06:42.691968389 +0200
@@ -387,6 +387,7 @@ use_thunk (tree thunk_fndecl, bool emit_
   thunk_node = cgraph_add_thunk (funcn, thunk_fndecl, function,
                                 this_adjusting, fixed_offset, virtual_value,
                                 virtual_offset, alias);
+  thunk_node->forced_by_abi = funcn->forced_by_abi;
   if (DECL_ONE_ONLY (function))
     symtab_add_to_same_comdat_group (thunk_node,
                                     funcn);
--- gcc/testsuite/g++.dg/lto/pr60567_0.C.jj     2014-04-10 12:04:07.227797680 
+0200
+++ gcc/testsuite/g++.dg/lto/pr60567_0.C        2014-04-10 12:06:18.063099605 
+0200
@@ -0,0 +1,23 @@
+// PR lto/60567
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -fno-use-linker-plugin } } }
+// { dg-extra-ld-options "-r -nostdlib" }
+
+#pragma implementation
+struct S {};
+
+#pragma interface
+struct T
+{
+  virtual void foo (const S &) = 0;
+};
+
+struct U
+{
+  virtual void bar (const S &) = 0;
+};
+
+struct V : public T, public U
+{
+  virtual void bar (const S &) {}
+};

        Jakub

Reply via email to