]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/56344 (ICE for program with very large structs returned by value)
authorMarek Polacek <polacek@redhat.com>
Tue, 3 Dec 2013 12:11:36 +0000 (12:11 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 3 Dec 2013 12:11:36 +0000 (12:11 +0000)
PR middle-end/56344
* calls.c (expand_call): Disallow passing huge arguments
by value.

From-SVN: r205628

gcc/ChangeLog
gcc/calls.c

index de5799c1a36ded064b11a8b2b2808a0dc4991a18..944e28cbbc4fb5d34c522a075543184474bb8a92 100644 (file)
@@ -1,3 +1,9 @@
+2013-12-03  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/56344
+       * calls.c (expand_call): Disallow passing huge arguments
+       by value.
+
 2013-12-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/59362
index 7d6327f28eff0f68d341ad40534aba3e97be5720..3963bc2975475941ea90079e59bfdded0bf71fec 100644 (file)
@@ -3045,6 +3045,15 @@ expand_call (tree exp, rtx target, int ignore)
            {
              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 - 2)))
+               {
+                 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)