This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix ICE due to invalid thunk (PR ipa/64776)


On Mon, 26 Jan 2015, Jakub Jelinek wrote:

> Hi!
> 
> On x86_64-darwin, we ICE on one of the pr64307.c testcase, because
> expand_thunk doesn't load non-gimple_val arguments into registers
> for the first argument, only for all the other ones.
> Supposedly normally thunks were meant to have this argument as pointer first
> and thus it wasn't an issue, but in the -O0 -fipa-icf case a thunk is
> created even for a non-method.
> 
> This patch fixes it by special-casing the first argument only if
> this_adjusting - then we know it is a pointer that is being adjusted.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2015-01-26  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR ipa/64776
> 	* cgraphunit.c (cgraph_node::expand_thunk): If not this_adjusting,
> 	handle the first argument in the same loop as all the other arguments.
> 
> --- gcc/cgraphunit.c.jj	2015-01-15 14:05:05.000000000 +0100
> +++ gcc/cgraphunit.c	2015-01-26 17:26:18.629818527 +0100
> @@ -1610,14 +1610,18 @@ cgraph_node::expand_thunk (bool output_a
>        for (arg = a; arg; arg = DECL_CHAIN (arg))
>          nargs++;
>        auto_vec<tree> vargs (nargs);
> +      i = 0;
> +      arg = a;
>        if (this_adjusting)
> -        vargs.quick_push (thunk_adjust (&bsi, a, 1, fixed_offset,
> -					virtual_offset));
> -      else if (nargs)
> -        vargs.quick_push (a);
> +	{
> +	  vargs.quick_push (thunk_adjust (&bsi, a, 1, fixed_offset,
> +					  virtual_offset));
> +	  arg = DECL_CHAIN (a);
> +	  i = 1;
> +	}
>  
>        if (nargs)
> -        for (i = 1, arg = DECL_CHAIN (a); i < nargs; i++, arg = DECL_CHAIN (arg))
> +	for (; i < nargs; i++, arg = DECL_CHAIN (arg))
>  	  {
>  	    tree tmp = arg;
>  	    if (!is_gimple_val (arg))
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Jennifer Guild,
Dilip Upmanyu, Graham Norton HRB 21284 (AG Nuernberg)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]