https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120871

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #11)
> (In reply to Andrew Pinski from comment #10)
> > 
> > Patch posted:
> > https://gcc.gnu.org/pipermail/gcc-patches/2025-July/688286.html
> > 
> > That just fixes the tail recusion part. The tail call part I will post a new
> > patch for PR 71761 in a few days.
> 
> I have the middle-end part for this but the x86 backend needs a fix. Once
> the other patches are approved, I will turn this into a target bug and the
> x86 folks can fix it.
> 
> But the problem is here:
>   a = ix86_function_value (TREE_TYPE (exp), decl_or_type, false);
>   b = ix86_function_value (TREE_TYPE (DECL_RESULT (cfun->decl)),
>                          cfun->decl, false);
> 
> The types are different because in one case it is the type of the struct
> while in the other case (DECL_RESULT) it is a pointer/reference type to the
> struct. So things fall over even though they are passed in the same
> register; the modes are different.

Actually I know how to fix it. it should be using the return type of the
function type of the decl instead of type of the result decl. Normally they
match up but sometimes they don't because of the reference type being used for
the "invisible" argument for structure types.

Reply via email to