https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92287
--- Comment #10 from Jozef Lawrynowicz <jozefl.gcc at gmail dot com> --- (In reply to gnzlbg from comment #9) > > @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? I think the ABI used to be correct regarding this, but then an optimization was added to the TI compiler to always passes structures/unions by registers. At least this is what I gleaned from searching the TI forums. In the past TI also confirmed to me directly that that structs/unions should always be passed by reference. I'll see if I can get them to update the ABI. If you are curious about what any back-end is trying to do regarding passing/returning by reference you could always check the implementation of TARGET_PASS_BY_REFERENCE or TARGET_RETURN_IN_MEMORY.