This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix a pretend_args goof in tail calling


On Sun, May 01, 2005 at 04:58:29PM -0700, Mark Mitchell wrote:
> The final question is "why shouldn't we use the pretend args space for 
> using the outgoing arguments to the sibling call?"  If these bytes are 
> contiguous with the incoming arguments, then there's no harm.  However, 
> the documentation for TARGET_ASM_FUNCTION_EPILOGUE (I have no idea why 
> pretend_args_size is documented *there*, but whatever) indicates that it 
> is indeed possible for the pretend region to be discontiguous from the 
> rest of the args.  If they're discontiguous, then your change is clearly 
> necessary.  And, if someone wants to add a target hook to say that these 
> two regions are contiguous, then they can do that, and conditionalize 
> your change on that.  Can you, by chance, confirm that the regions were 
> not contiguous on the machine you were working with?

No, that's not right.  This patch was for a problem found on ARM
targets, and it is contiguous.  The problem is that the space is
"pretend".  It's allocated by the called function, not by the caller,
so it must be cleaned up before we leave this function or the stack
pointer will be corrupted.  Therefore it can not be used for outgoing
arguments.

Therefore the existing comment is right.  It could be extended to:
       /* If this function requires more stack slots than the current
	  function, we cannot change it into a sibling call.
	  current_function_pretend_args_size is not part of the
	  stack allocated by our caller.  */

OK with that change instead?

-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]