https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63668
Bug ID: 63668 Summary: -mstd-struct-return fails for non-leaf functions Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: rth at gcc dot gnu.org With optimization, the return address adjustment that's applied for -mstd-struct-return is deleted as dead code, resulting in a return directly to the unimp insn. struct S { int x, y, z; }; void bar(void); struct S foo(void) { struct S s = { 1, 2, 3 }; bar(); return s; } -O0: save %sp, -128, %sp ld [%i7+8], %g1 add %i7, 4, %i7 cmp %g1, 12 be .L2 nop sub %i7, 4, %i7 add %fp, -20, %g1 st %g1, [%fp+64] .L2: -O2: foo: save %sp, -112, %sp ld [%i7+8], %g1 cmp %g1, 12 be .L2 add %fp, -4, %g1 st %g1, [%fp+64] .L2: