diff mbox

Fix ICE with -flto -fno-use-linker-plugin (PR lto/60567)

Message ID 20140410132744.GC1817@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek April 10, 2014, 1:27 p.m. UTC
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  <hubicka@ucw.cz>
	    Jakub Jelinek  <jakub@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.


	Jakub

Comments

Jason Merrill April 10, 2014, 1:51 p.m. UTC | #1
On 04/10/2014 09:27 AM, Jakub Jelinek wrote:
> 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 think Honza and I agreed yesterday to copy it in 
function_and_variable_visibility.

Jason
diff mbox

Patch

--- 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 &) {}
+};