diff mbox

[PR,ipa/66616] Fix artificial thunk ABI issues

Message ID 20160108151850.GE3982@virgil.suse.cz
State New
Headers show

Commit Message

Martin Jambor Jan. 8, 2016, 3:18 p.m. UTC
Hi,

i386 -m32 failure of the PR 66616 testcase was caused by the fact
that, on the callee side, the calling conventions of a thunk are
decided according to the properties of the function it is associated
with, but on the caller side, the actual thunk is examined.  Since
they depend on the can_change_signature cgraph_node flag and the flag
of artificial thunks has not been copied from the function, the caller
and callee could disagree on ABI.

Fixed thusly, by copying the flag to the artificial thunk.  Testcase
is already in the testsuite (g++.dg/ipa/pr66616.C).  The patch has
successfully passed bootstrap and testing on i686-linux, I have also
included it in a bootstrap and testing that is underway on
x86_64-linux.  OK if it passes there as well?

Thanks,

Martin


[PR ipa/66616] Copy can_change_signature flag to artificial thunks

2016-01-07  Martin Jambor  <mjambor@suse.cz>

	PR ipa/66616
	* cgraphclones.c (duplicate_thunk_for_node): Copy can_change_signature
	flag.

Comments

Jan Hubicka Jan. 8, 2016, 8:11 p.m. UTC | #1
> Hi,
> 
> i386 -m32 failure of the PR 66616 testcase was caused by the fact
> that, on the callee side, the calling conventions of a thunk are
> decided according to the properties of the function it is associated
> with, but on the caller side, the actual thunk is examined.  Since
> they depend on the can_change_signature cgraph_node flag and the flag
> of artificial thunks has not been copied from the function, the caller
> and callee could disagree on ABI.
> 
> Fixed thusly, by copying the flag to the artificial thunk.  Testcase
> is already in the testsuite (g++.dg/ipa/pr66616.C).  The patch has
> successfully passed bootstrap and testing on i686-linux, I have also
> included it in a bootstrap and testing that is underway on
> x86_64-linux.  OK if it passes there as well?
> 
> Thanks,
> 
> Martin
> 
> 
> [PR ipa/66616] Copy can_change_signature flag to artificial thunks
> 
> 2016-01-07  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR ipa/66616
> 	* cgraphclones.c (duplicate_thunk_for_node): Copy can_change_signature
> 	flag.

OK,
thanks
Honza
> 
> diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
> index f8a7d37..8759ce4 100644
> --- a/gcc/cgraphclones.c
> +++ b/gcc/cgraphclones.c
> @@ -328,6 +328,7 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
>    new_thunk = cgraph_node::create (new_decl);
>    set_new_clone_decl_and_node_flags (new_thunk);
>    new_thunk->definition = true;
> +  new_thunk->local.can_change_signature = node->local.can_change_signature;
>    new_thunk->thunk = thunk->thunk;
>    new_thunk->unique_name = in_lto_p;
>    new_thunk->former_clone_of = thunk->decl;
diff mbox

Patch

diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index f8a7d37..8759ce4 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -328,6 +328,7 @@  duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
   new_thunk = cgraph_node::create (new_decl);
   set_new_clone_decl_and_node_flags (new_thunk);
   new_thunk->definition = true;
+  new_thunk->local.can_change_signature = node->local.can_change_signature;
   new_thunk->thunk = thunk->thunk;
   new_thunk->unique_name = in_lto_p;
   new_thunk->former_clone_of = thunk->decl;