summaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-19 19:15:03 +0000
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-19 19:15:03 +0000
commitc0e7e9f74f1d8ce4e4513cf5243bb87cce8c132d (patch)
treeafbd7145d766cc18a51d78c2499ef49900a49553 /gcc/calls.c
parenta569a60f8b882415dd93080f793a11f0a04fde5c (diff)
downloadgcc-c0e7e9f74f1d8ce4e4513cf5243bb87cce8c132d.tar.gz
PR middle-end/35616
* calls.c (expand_call): Check overlap of arguments with call address for sibcalls. * gcc.dg/pr35616.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133348 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index 657439a60eb..2d68f7507a5 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2326,7 +2326,7 @@ expand_call (tree exp, rtx target, int ignore)
int save_pending_stack_adjust = 0;
int save_stack_pointer_delta = 0;
rtx insns;
- rtx before_call, next_arg_reg;
+ rtx before_call, next_arg_reg, after_args;
if (pass == 0)
{
@@ -2756,6 +2756,7 @@ expand_call (tree exp, rtx target, int ignore)
use_reg (&call_fusage, struct_value);
}
+ after_args = get_last_insn ();
funexp = prepare_call_address (funexp, static_chain_value,
&call_fusage, reg_parm_seen, pass == 0);
@@ -2790,6 +2791,13 @@ expand_call (tree exp, rtx target, int ignore)
next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage,
flags, & args_so_far);
+ /* If the call setup or the call itself overlaps with anything
+ of the argument setup we probably clobbered our call address.
+ In that case we can't do sibcalls. */
+ if (pass == 0
+ && check_sibcall_argument_overlap (after_args, 0, 0))
+ sibcall_failure = 1;
+
/* If a non-BLKmode value is returned at the most significant end
of a register, shift the register right by the appropriate amount
and update VALREG accordingly. BLKmode values are handled by the