https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92287
gnzlbg <gonzalobg88 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #7 from gnzlbg <gonzalobg88 at gmail dot com> --- > Note that the situation for zero-sized structs isn't very clear in most ABIs, these included. This is incorrect: zero-sized types are well-defined and efficient on most ABIs (most ABIs have a rule for small sizes, and these rules cover zero-sized types). AFAICT, these two (MSP430 and PPC32) are some of the very few ABIs in which zero-sized types waste one register and one instruction for no reason. > You must have an unusual program if this ever matters ;-) This bug / question was spawned due to a PR that attempted to fix a bug in Rust for these ABIs when zero-sized types are involved. Rust has first-class support for ZSTs and they are widely used, so the unusual situation where this happens is essentially "all Rust programs". While ZSTs are "free" on most ABIs, on these particular two, the ABI spec does not cover them, making "what GCC does" essentially the only documented behavior for these. Hence the question, is wasting one register and one instruction for ZSTs on these platforms a GCC bug, or part of the intended ABI for these? It appears that the answer is that this is intended: these ABIs always pass structs and unions indirectly, even if they are zero-sized, and that just means that a register and an instruction must be used when ZSTs are passed, even if those registers will never be read by anything. These ABIs know about this and find it an acceptable trade-off, so that's what Rust will do.