diff options
Diffstat (limited to 'gcc/calls.c')
-rw-r--r-- | gcc/calls.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index 726ba23c3fc..3963bc29754 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -27,6 +27,11 @@ along with GCC; see the file COPYING3. If not see #include "varasm.h" #include "stringpool.h" #include "attribs.h" +#include "basic-block.h" +#include "tree-ssa-alias.h" +#include "internal-fn.h" +#include "gimple-expr.h" +#include "is-a.h" #include "gimple.h" #include "flags.h" #include "expr.h" @@ -2667,8 +2672,7 @@ expand_call (tree exp, rtx target, int ignore) recursion "call". That way we know any adjustment after the tail recursion call can be ignored if we indeed use the tail call expansion. */ - int save_pending_stack_adjust = 0; - int save_stack_pointer_delta = 0; + saved_pending_stack_adjust save; rtx insns; rtx before_call, next_arg_reg, after_args; @@ -2676,8 +2680,7 @@ expand_call (tree exp, rtx target, int ignore) { /* State variables we need to save and restore between iterations. */ - save_pending_stack_adjust = pending_stack_adjust; - save_stack_pointer_delta = stack_pointer_delta; + save_pending_stack_adjust (&save); } if (pass) flags &= ~ECF_SIBCALL; @@ -3042,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) @@ -3433,8 +3445,7 @@ expand_call (tree exp, rtx target, int ignore) /* Restore the pending stack adjustment now that we have finished generating the sibling call sequence. */ - pending_stack_adjust = save_pending_stack_adjust; - stack_pointer_delta = save_stack_pointer_delta; + restore_pending_stack_adjust (&save); /* Prepare arg structure for next iteration. */ for (i = 0; i < num_actuals; i++) |