https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90765
Bug ID: 90765 Summary: preferred_stack_boundary is updated for callee Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: skpgkp1 at gmail dot com Target Milestone: --- locate_and_pad_parm is called when expanding function call from initialize_argument_information and when generating function body from assign_parm_find_entry_rtl: /* Remember if the outgoing parameter requires extra alignment on the calling function side. */ if (crtl->stack_alignment_needed < boundary) crtl->stack_alignment_needed = boundary; if (crtl->preferred_stack_boundary < boundary) crtl->preferred_stack_boundary = boundary; preferred_stack_boundary should be updated only when expanding function call, not when generating function body. In this testcase, crtl->preferred_stack_boundary is to set 512 when not needed: [hjl@gnu-cfl-1 lea-3]$ cat 1.i typedef int __v16si __attribute__ ((__vector_size__ (64))); void foo (__v16si x, int i0, int i1, int i2, int i3, int i4, int i5, __v16si *p) { *p = x; } [hjl@gnu-cfl-1 lea-3]$ make 1.s /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -mavx512f -O2 -Wa,-mx86-used-note=yes -S 1.i [hjl@gnu-cfl-1 lea-3]$ cat 1.s .file "1.i" .text .p2align 4 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 andq $-64, %rsp movq 16(%rbp), %rax vmovdqa64 %zmm0, (%rax) leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size foo, .-foo .ident "GCC: (GNU) 10.0.0 20190605 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-1 lea-3]$