https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89993
Bug ID: 89993 Summary: Inconsistent incoming stack boundary Product: gcc Version: 8.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: ubizjak at gmail dot com Target Milestone: --- Target: i386,x86-64 It looks like the default incoming stack isn't a constant: [hjl@gnu-cfl-1 tmp]$ cat a.c int tst2Foo(int*, int*, int); int tst1Foo(int* pSrc, int* pDst, int len) { return tst2Foo(pSrc, pDst, len); } [hjl@gnu-cfl-1 tmp]$ gcc -mstackrealign -S -O2 a.c [hjl@gnu-cfl-1 tmp]$ cat a.s .file "a.c" .text .p2align 4,,15 .globl tst1Foo .type tst1Foo, @function tst1Foo: .LFB0: .cfi_startproc jmp tst2Foo .cfi_endproc .LFE0: .size tst1Foo, .-tst1Foo .ident "GCC: (GNU) 8.3.1 20190311 (Red Hat 8.3.1-3)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-1 tmp]$ gcc -mstackrealign -S -O2 a.c -mincoming-stack-boundary=3 [hjl@gnu-cfl-1 tmp]$ cat a.s .file "a.c" .text .p2align 4,,15 .globl tst1Foo .type tst1Foo, @function tst1Foo: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 andq $-16, %rsp call tst2Foo leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size tst1Foo, .-tst1Foo .ident "GCC: (GNU) 8.3.1 20190311 (Red Hat 8.3.1-3)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-1 tmp]$ cat b.c #include <xmmintrin.h> int tst2Foo(int*, int*, int, __m128*); int tst1Foo(int* pSrc, int* pDst, int len) { __m128 x; return tst2Foo(pSrc, pDst, len, &x); } [hjl@gnu-cfl-1 tmp]$ gcc -mstackrealign -S -O2 b.c -mincoming-stack-boundary=4 [hjl@gnu-cfl-1 tmp]$ cat b.s .file "b.c" .text .p2align 4,,15 .globl tst1Foo .type tst1Foo, @function tst1Foo: .LFB526: .cfi_startproc subq $24, %rsp .cfi_def_cfa_offset 32 movq %rsp, %rcx call tst2Foo addq $24, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE526: .size tst1Foo, .-tst1Foo .ident "GCC: (GNU) 8.3.1 20190311 (Red Hat 8.3.1-3)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-1 tmp]$