https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61300
Ulrich Weigand <uweigand at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |uweigand at gcc dot gnu.org --- Comment #6 from Ulrich Weigand <uweigand at gcc dot gnu.org> --- Note that either of the proposed changes (comment #3 or comment #5) would result in an incompatible ABI change, since other compilers already implement the parameter save area rules as defined by the ELFv2 ABI. The basic rule is: A function body may expect the parameter save area to have been provided on its callers stack *iff* the function has either some argument that is passed in memory according to calling convention rules, or the function has a variable argument list. This is the only correct rule to be used when generating code for a function body, no matter whether the function definition uses K&R style or not, or whether there is a prototype in scope at the definition site or not. Now, when generating a function *call*, we of course may follow the same rule, which we can do if we have a prototype in scope, or else we may opt to always provide the parameter save area (which is the only safe option if there is *no* prototype in scope). The problem is that the same macro REG_PARM_STACK_SPACE is currently invoked for both function calls and function definitions, so the test for prototype_p is wrong if we're currently compiling a function definition. Is there a way to inspect the REG_PARM_STACK_SPACE argument to distinguish those cases?