From 6a48df451f671cc41481c85a2d1c4382a72e0832 Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Mon, 21 Apr 2003 23:08:50 +0200 Subject: [PATCH] calls.c (expand_call): Prevent sibcall optimization for calls to nested subprograms. * calls.c (expand_call): Prevent sibcall optimization for calls to nested subprograms. From-SVN: r65904 --- gcc/ChangeLog | 5 +++++ gcc/calls.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b27996f50e1..decc4b14b45 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-04-21 Olivier Hainque + + * calls.c (expand_call): Prevent sibcall optimization for calls to + nested subprograms. + 2003-04-21 Joel Brobecker * dwarf2out.c (is_ada, is_ada_subrange_type): New functions. diff --git a/gcc/calls.c b/gcc/calls.c index 9b49f8719c2..06ed14a00e4 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2515,6 +2515,10 @@ expand_call (exp, target, ignore) optimized. */ || (flags & (ECF_RETURNS_TWICE | ECF_LONGJMP | ECF_NORETURN)) || TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (addr))) + /* If the called function is nested in the current one, it might access + some of the caller's arguments, but could clobber them beforehand if + the argument areas are shared. */ + || (fndecl && decl_function_context (fndecl) == current_function_decl) /* If this function requires more stack slots than the current function, we cannot change it into a sibling call. */ || args_size.constant > current_function_args_size -- 2.30.2