https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66750
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2015-07-03 Ever confirmed|0 |1 --- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> --- We have 'callee_pop_aggregate_return (NUMBER)' On x86-32 targets, you can use this attribute to control how aggregates are returned in memory. If the caller is responsible for popping the hidden pointer together with the rest of the arguments, specify NUMBER equal to zero. If callee is responsible for popping the hidden pointer, specify NUMBER equal to one. The default x86-32 ABI assumes that the callee pops the stack for hidden pointer. However, on x86-32 Microsoft Windows targets, the compiler assumes that the caller pops the stack for hidden pointer. and static int ix86_return_pops_args (tree fundecl, tree funtype, int size) { ... /* Lose any fake structure return argument if it is passed on the stack. */ if (aggregate_value_p (TREE_TYPE (funtype), fundecl) && !ix86_keep_aggregate_return_pointer (funtype)) { int nregs = ix86_function_regparm (funtype, fundecl); if (nregs == 0) return GET_MODE_SIZE (Pmode); } return 0; } For -miamcu and -m64, ix86_return_pops_args always returns 0 since they pass parameters in registers. We have 2 choices: 1. Update IA MCU psABI to follow x86-64 psABI such that callee doesn't pop the stack. 2. Update GCC to always pop stack for -m32. I prefer #1.