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


Daniel Jacobowitz wrote:

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.

Oh; the problem would be that when the eventual return occurred from the sibcalled function, we'd have more stack space allocated than the original caller expected. So, if the original caller pops the arguments, it won't pop enough. If the ABI had the callee pop the args, then things would work OK, I guess, because the sibcalled function would pop all the space. Is that right?


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?

OK.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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