diff mbox

Fix PR44941

Message ID 9DA9D36B-6A09-48E0-8B14-E4E41EE0A2D0@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe July 21, 2010, 7:15 a.m. UTC
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?
Iain




  	      /* Handle a BLKmode that needs shifting.  */

Comments

Richard Biener July 21, 2010, 8:13 a.m. UTC | #1
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.  */
>
Iain Sandoe July 22, 2010, 8:03 a.m. UTC | #2
On 21 Jul 2010, at 09:13, Richard Guenther wrote:
>> OK for trunk?
>
> Ok with a proper changelog entry and ....

done
>> +		      || mem_overlaps_already_clobbered_arg_p (
>
> the parantheses moved to the next line.

done

r162402
Iain
diff mbox

Patch

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 (
+					    XEXP (args[i].value, 0), size)))
  		*sibcall_failure = 1;