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 PR44941


On Wed, 21 Jul 2010, IainS wrote:

> Hi Richard,
> 
> On 19 Jul 2010, at 13:42, Richard Guenther wrote:
> 
> > 
> > This fixes PR44941 by early handling arguments of size zero.  With
> > MEM_REF type-punned cases can now be registers which we do not handle
> > properly.  After fixing this you can now see that we can avoid generating
> > the stack slot for the zero-sized arg completely.
> > 
> > Bootstrapped and tested on x86_64-unknown-linux-gnu.  Comments?
> 
> 
> > 2010-07-19  Richard Guenther  <rguenther@suse.de>
> > 
> > 	PR middle-end/44941
> > 	* expr.c (emit_block_move_hints): Move zero size check first.
> > 	Move asserts to more useful places.
> > 	* calls.c (load_register_parameters): Check for zero size.
> > 
> > 	* gcc.c-torture/compile/pr44941.c: New testcase.
> > 	    {
> > 	      rtx mem = validize_mem (args[i].value);
> 
> The change to calls.c caused some compat/* fails on powerpc*-darwin9.
> 
> As discussed on irc, (hopefully I understood what was wanted)
> the attached patch restores powerpc...
> ...  whilst compile.exp=pr44941.c still passes on i686-darwin9.
> bootstrapped on {i686,powerpc}-darwin9
> OK for trunk?

Ok with a proper changelog entry and ....

> Iain
> 
> 
> 
> 
> Index: gcc/calls.c
> ===================================================================
> --- gcc/calls.c	(revision 162339)
> +++ gcc/calls.c	(working copy)
> @@ -1668,15 +1668,16 @@ load_register_parameters (struct arg_data *args, i
> 	      emit_move_insn (gen_rtx_REG (word_mode, REGNO (reg) + j),
> 			      args[i].aligned_regs[j]);
> 
> -	  else if ((partial == 0 || args[i].pass_on_stack)
> -		   && size != 0)
> +	  else if (partial == 0 || args[i].pass_on_stack)
> 	    {
> 	      rtx mem = validize_mem (args[i].value);
> 
> -	      /* Check for overlap with already clobbered argument area.  */
> +	      /* Check for overlap with already clobbered argument area,
> +	         providing that this has finite size.  */
> 	      if (is_sibcall
> -		  && mem_overlaps_already_clobbered_arg_p (XEXP
> (args[i].value, 0),
> -							   size))
> +		  && (size == 0
> +		      || mem_overlaps_already_clobbered_arg_p (

the parantheses moved to the next line.

Thanks,
Richard.

> +					    XEXP (args[i].value, 0), size)))
> 		*sibcall_failure = 1;
> 
> 	      /* Handle a BLKmode that needs shifting.  */
> 


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