Fix a pretend_args goof in tail calling
Daniel Jacobowitz
drow@false.org
Tue Apr 26 16:39:00 GMT 2005
On Fri, Nov 19, 2004 at 05:48:44PM -0500, Daniel Jacobowitz wrote:
> I noticed this problem in GCC 3.3, and it's still present. As far as I can
> tell, the size of a function's incoming arguments area is
> current_function_args_size - current_function_pretend_args_size; if we want
> to put another function's arguments into our stack frame, they have to fit
> there.
>
> The test case caused a target with four-byte stack alignment to store one
> word past the top of its stack frame, into the caller's. I couldn't get GCC
> to put anything useful in the other half of the stack frame, though. The
> ARM old-iWMMXt-ABI code showed other symptoms resulting from this, but that
> ABI's no longer present in mainline to test.
>
> Patch OK for HEAD?
Ping.
In a followup last November, I added that this patch was bootstrapped
and regression tested on powerpc64-unknown-linux-gnu.
> 2004-11-17 Daniel Jacobowitz <dan@codesourcery.com>
>
> * calls.c (expand_call): Handle current_function_pretend_args_size
> when checking for sibcalls.
>
> --- gcc/gcc/calls.c.orig 2004-11-17 18:42:41.000000000 -0500
> +++ gcc/gcc/calls.c 2004-11-17 18:42:35.000000000 -0500
> @@ -2518,7 +2518,8 @@
> || !FUNCTION_OK_FOR_SIBCALL (fndecl)
> /* 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
> + || args_size.constant > (current_function_args_size
> + - current_function_pretend_args_size)
> /* If the callee pops its own arguments, then it must pop exactly
> the same number of arguments as the current function. */
> || (RETURN_POPS_ARGS (fndecl, funtype, args_size.constant)
>
--
Daniel Jacobowitz
CodeSourcery, LLC
More information about the Gcc-patches
mailing list