https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120689
Bug ID: 120689 Summary: Codegen optimization regression passing struct in register in gcc 10+ on x86-64. Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: amohr at amohr dot org Target Milestone: --- struct s { char a, b, c; }; void t2(s); void t1(s x) { t2(x); } GCC 9.5 on x86-64 at -O3 generates: t1(s): jmp t2(s) GCC 10.1 (and newer) at -O3 generates: t1(s): mov edx, edi mov eax, edi movzx edi, dil shr eax, 16 and edx, 65280 or rdx, rdi movzx edi, al sal rdi, 16 or rdi, rdx jmp t2(s) I tested all newer major versions thru 15 & trunk, and they do similarly.