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

--- Comment #10 from Jeffrey A. Law <law at redhat dot com> ---
I understand everything you're saying Richi.  Note however that the MIPS
backend explicitly wants to align things based on the object's alignment --
even scalars passed in registers:

/* Advance to an even register if the argument is doubleword-aligned.  */
  if (doubleword_aligned_p)
    info->reg_offset += info->reg_offset & 1;

Which can be tracked back to this commit:
commit 26bcab5a0015a5304899649081f7777d676996b8
Author: rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Sat Sep 25 07:42:43 2004 +0000

        * config/mips/mips.h (struct mips_args): Clarify comments.
        * config/mips/mips.c (struct mips_arg_info): Likewise.
        (mips_arg_info): Don't allow fpr_p to affect the register or
        stack alignment.  Remove o64 silliness.
        (function_arg): Deal with the o32 float,float case specially.

Which is the end of a slew of fixes to this code -- enough that tracking down
the original source of the aligned register stuff is painful at best.  

I'm nowhere near comfortable to take this further -- my MIPS knowledge is old
and limited more to the ISA than the nitty gritty details of argument passing.

One could argue that this kind of alignment hackery is fundamentally broken and
can't be baked into the ABI.  But the reality is this code has been in GCC for
well over a decade, so it has effectively become part of the ABI.

Anyway, leaving to the MIPS maintainers to sort out.  It ought to be
dramatically easier at this point.

Reply via email to