https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109567
Bug ID: 109567 Summary: Useless stack adjustment by 16 around calls with odd stack-argument counts on SysV x86_64 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: pskocik at gmail dot com Target Milestone: --- For function calls with odd stack argument counts, gcc generates a useless `sub $16, %rsp` at the beginning of the calling function. Example (https://godbolt.org/z/Y4ErE8ee9): #include <stdio.h> int callprintf_0stk(char const*Fmt){ return printf(Fmt,0,0,0,0,0),0; } int callprintf_1stk(char const *Fmt){ return printf(Fmt,0,0,0,0,0, 1),0; } //useless sub $0x10,%rsp int callprintf_2stk(char const *Fmt){ return printf(Fmt,0,0,0,0,0, 1,2),0; } int callprintf_3stk(char const *Fmt){ return printf(Fmt,0,0,0,0,0, 1,2,3),0; } //useless sub $0x10,%rsp int callprintf_4stk(char const *Fmt){ return printf(Fmt,0,0,0,0,0, 1,2,3,4),0; } int callprintf_5stk(char const *Fmt){ return printf(Fmt,0,0,0,0,0, 1,2,3,4,5),0; } //useless sub $0x10,%rsp int callprintf_6stk(char const *Fmt){ return printf(Fmt,0,0,0,0,0, 1,2,3,4,5,6),0; } int callprintf_7stk(char const *Fmt){ return printf(Fmt,0,0,0,0,0, 1,2,3,4,5,6,7),0; } //useless sub $0x10,%rsp