On 6/6/26 12:32, Oleg Tolmatcev wrote:
From: oltolm <[email protected]>
Fix PR54412 by preserving over-alignment for stack slots used for
indirect argument passing and returns on Win64 targets that require it.
On x86_64-w64-mingw32, TARGET_SEH limits
MAX_SUPPORTED_STACK_ALIGNMENT to 128 bits, but fixed-size AVX and
AVX512 values can still require greater alignment when passed or
returned indirectly. Generic stack-slot allocation can therefore
produce under-aligned slots, leading to misaligned aligned-move
accesses and runtime failures.
Add target hooks so targets can opt in to preserving over-alignment
and select which type classes require that treatment. For i386 under
TARGET_SEH, use this for fixed-size AVX and AVX512 payload types.
Introduce assign_stack_local_aligned for stack slots whose requested
alignment exceeds MAX_SUPPORTED_STACK_ALIGNMENT, and avoid reusing
preserved over-aligned temporary stack slots when that could lose the
derived aligned address.
This preserves existing ABI behavior while ensuring the required
alignment for affected Win64 indirect stack-slot cases.
I have ran a test on x86_64 Linux, there don't seem to be any new
testcase failures.