https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97267
Bug ID: 97267
Summary: Missed tail calls on ppc64 ELFv2
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: amodra at gmail dot com
Target Milestone: ---
static int __attribute__ ((__noclone__, __noinline__))
reg_args (int j1, int j2, int j3, int j4, int j5, int j6, int j7, int j8)
{
return j1 + j2 + j3 + j4 + j5 + j6 + j7 + j8;
}
int __attribute__ ((__noclone__, __noinline__))
stack_args (int j1, int j2, int j3, int j4, int j5, int j6, int j7, int j8,
int j9)
{
if (j9 == 0)
return 0;
return reg_args (j1, j2, j3, j4, j5, j6, j7, j8);
}
This ought to result on a tail call from stack_args to reg_args on ELFv2 like
it does on ELFv1, ppc32, x86_64 and so on. Failure to do so is the result of
an overly restrictive test in calls.c:can_implement_as_sibling_call_p.