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

--- Comment #32 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
One of the reasons we changed the ABI on various arches one way or another is
that we had this ABI incompatibility between C and C++, that just can't be
right.
At that time we can and should decide if we go for compatibility with C or C++.
The MIPS n64 wording I could find:
"Regardless of the struct field structure, it is treated as a sequence of
64-bit chunks. If a chunk consists solely of a double float field (but not a
double, which is part of a union), it is passed in a floating point register.
Any other chunk is passed in an integer register."
is unclear for both the zero width bitfields and empty structure/union C
members,
members that have zero size and are on the 64-bit chunk boundaries can belong
to either previous or next chunk or can be ignored altogether.

I think best would be to ignore them altogether, especially if other compilers
do that too.
Also consider:
struct T {};
struct S { struct T t; double a; struct T u; double b; };
struct U { int a[0]; double b; int c[0]; double d; };
argument passing in C (etc.) - in C++ struct T will have size 1 and therefore
will be passed differently between C (which pedantically disallows empty
structures or zero length arrays) and C++.

Reply via email to