https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273
--- Comment #14 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Zeb Figura from comment #13) > (In reply to Sam James from comment #11) > > (In reply to Jens-Hanno Schwalm from comment #10) > > > Hi, i think we found a very-similar issue in darktable code, you might > > > look > > > at > > > > > > https://github.com/darktable-org/darktable/pull/15742 > > > > > > > If you're hitting this on another target than i686-w64-mingw32, please file > > a new bug. We can always mark it as a dupe if it turns out to be, although I > > suspect it isn't here. > > FWIW, I think the relevant part of i686-w64-ming32 is actually just > STACK_REALIGN_DEFAULT. I can reproduce the same lack of alignment with > "-mstackrealign -mavx512 -O2" with i386-linux-gnu, whereas "-mstackrealign > -mavx2 -O2" does align the stack. [-O2 is necessary here otherwise gcc will > just use vmovdqu and not bother aligning the stack. No idea what the more > targeted optimization is.] > For the attached testcase here, GCC 13.2 generates: [hjl@gnu-cfl-3 tmp]$ gcc -S -mstackrealign -mavx512f -O2 -m32 x.c [hjl@gnu-cfl-3 tmp]$ head -20 x.s .file "x.c" .text .p2align 4 .globl ddraw7_GetCaps .type ddraw7_GetCaps, @function ddraw7_GetCaps: .LFB0: .cfi_startproc leal 4(%esp), %ecx .cfi_def_cfa 1, 0 andl $-16, %esp <<<<< Stack realignment. vpxor %xmm0, %xmm0, %xmm0 xorl %eax, %eax pushl -4(%ecx) pushl %ebp movl %esp, %ebp .cfi_escape 0x10,0x5,0x2,0x75,0 pushl %edi pushl %ecx .cfi_escape 0xf,0x3,0x75,0x78,0x6 [hjl@gnu-cfl-3 tmp]$ It works for me. Please file a separate bug if-mstackrealign -mavx512f -O2 doesn't work for you on Linux.