[Bug target/92287] Mismatches in the calling convention for zero sized types

gonzalobg88 at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Oct 31 18:56:00 GMT 2019


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

--- Comment #9 from gnzlbg <gonzalobg88 at gmail dot com> ---
> sparc is another, for example.  And or1k, too.

Yeah, I was wrong. x86/x64, arm32/64, aarch64, riscv, ppc64, mips64, ... are
some of the ABIs that do not have any of these issues because they special case
"all aggregates smaller than X", and that covers zero-sized types. 

Some ABIs (e.g. ppc32, MSP430) just say that all aggregates are passed by
reference, period.

And some ABIs (s390x, sparc as well I think), special case some sizes (e.g. 1,
2, 4, and 8 bytes wide aggregates), which means that 0 byte wide aggregates end
up being passed by reference instead.

---

@josef

> The MSP430 ABI is here: http://www.ti.com/lit/an/slaa534/slaa534.pdf
Although confusingly that document is wrong regarding passing structures and
unions by reference. As I mentioned before, structures and unions are always
passed by reference, regardless of size.

Can you expand on this? That document says that aggregates smaller than 32-bit
are passed in registers. We were trying to update our code documentation to
cite the ABI specs and realized this. Do you have a link to where the current
behavior is specified?


More information about the Gcc-bugs mailing list