diff mbox

Fix PR56344

Message ID 20131202164033.GF9986@redhat.com
State New
Headers show

Commit Message

Marek Polacek Dec. 2, 2013, 4:40 p.m. UTC
On Mon, Dec 02, 2013 at 04:01:05PM +0100, Richard Biener wrote:
> On Wed, Mar 13, 2013 at 1:57 PM, Marek Polacek <polacek@redhat.com> wrote:
> > Ping.
> 
> Ok.  (yay, oldest patch in my review queue ...)

;) thanks.  Just to be sure, did you mean to ok this patch (that is,
the one with HOST_BITS_PER_INT)?

Bootstrap/regtest in progress.

2013-12-02  Marek Polacek  <polacek@redhat.com>

	PR middle-end/56344
	* calls.c (expand_call): Disallow passing huge arguments
	by value.


	Marek

Comments

Marek Polacek Dec. 2, 2013, 7:19 p.m. UTC | #1
On Mon, Dec 02, 2013 at 05:40:33PM +0100, Marek Polacek wrote:
> On Mon, Dec 02, 2013 at 04:01:05PM +0100, Richard Biener wrote:
> > On Wed, Mar 13, 2013 at 1:57 PM, Marek Polacek <polacek@redhat.com> wrote:
> > > Ping.
> > 
> > Ok.  (yay, oldest patch in my review queue ...)
> 
> ;) thanks.  Just to be sure, did you mean to ok this patch (that is,
> the one with HOST_BITS_PER_INT)?
> 
> Bootstrap/regtest in progress.
> 
> 2013-12-02  Marek Polacek  <polacek@redhat.com>
> 
> 	PR middle-end/56344
> 	* calls.c (expand_call): Disallow passing huge arguments
> 	by value.
> 
> --- gcc/calls.c.mp4	2013-12-02 17:12:18.621057873 +0100
> +++ gcc/calls.c	2013-12-02 17:32:35.523684716 +0100
> @@ -3047,6 +3047,15 @@ expand_call (tree exp, rtx target, int i
>  	    {
>  	      rtx before_arg = get_last_insn ();
>  
> +	      /* We don't allow passing huge (> 2^30 B) arguments
> +	         by value.  It would cause an overflow later on.  */
> +	      if (adjusted_args_size.constant
> +		  >= (1 << (HOST_BITS_PER_INT - 1)))

Surely I meant to use "HOST_BITS_PER_INT - 2" here.

	Marek
Richard Biener Dec. 2, 2013, 8:37 p.m. UTC | #2
Marek Polacek <polacek@redhat.com> wrote:
>On Mon, Dec 02, 2013 at 05:40:33PM +0100, Marek Polacek wrote:
>> On Mon, Dec 02, 2013 at 04:01:05PM +0100, Richard Biener wrote:
>> > On Wed, Mar 13, 2013 at 1:57 PM, Marek Polacek <polacek@redhat.com>
>wrote:
>> > > Ping.
>> > 
>> > Ok.  (yay, oldest patch in my review queue ...)
>> 
>> ;) thanks.  Just to be sure, did you mean to ok this patch (that is,
>> the one with HOST_BITS_PER_INT)?

Yes, thanks,
Richard.

>> Bootstrap/regtest in progress.
>> 
>> 2013-12-02  Marek Polacek  <polacek@redhat.com>
>> 
>> 	PR middle-end/56344
>> 	* calls.c (expand_call): Disallow passing huge arguments
>> 	by value.
>> 
>> --- gcc/calls.c.mp4	2013-12-02 17:12:18.621057873 +0100
>> +++ gcc/calls.c	2013-12-02 17:32:35.523684716 +0100
>> @@ -3047,6 +3047,15 @@ expand_call (tree exp, rtx target, int i
>>  	    {
>>  	      rtx before_arg = get_last_insn ();
>>  
>> +	      /* We don't allow passing huge (> 2^30 B) arguments
>> +	         by value.  It would cause an overflow later on.  */
>> +	      if (adjusted_args_size.constant
>> +		  >= (1 << (HOST_BITS_PER_INT - 1)))
>
>Surely I meant to use "HOST_BITS_PER_INT - 2" here.
>
>	Marek
diff mbox

Patch

--- gcc/calls.c.mp4	2013-12-02 17:12:18.621057873 +0100
+++ gcc/calls.c	2013-12-02 17:32:35.523684716 +0100
@@ -3047,6 +3047,15 @@  expand_call (tree exp, rtx target, int i
 	    {
 	      rtx before_arg = get_last_insn ();
 
+	      /* We don't allow passing huge (> 2^30 B) arguments
+	         by value.  It would cause an overflow later on.  */
+	      if (adjusted_args_size.constant
+		  >= (1 << (HOST_BITS_PER_INT - 1)))
+	        {
+	          sorry ("passing too large argument on stack");
+		  continue;
+		}
+
 	      if (store_one_arg (&args[i], argblock, flags,
 				 adjusted_args_size.var != 0,
 				 reg_parm_stack_space)