https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127650

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Uros Bizjak <[email protected]>:

https://gcc.gnu.org/g:3659136d5a21a23381c0c5effada9a02cf14ea58

commit r16-9748-g3659136d5a21a23381c0c5effada9a02cf14ea58
Author: Uros Bizjak <[email protected]>
Date:   Tue Sep 29 11:24:01 2026 +0200

    i386: Do not over-align va_arg access to an over-aligned stack argument
[PR127650]

    ix86_function_arg_boundary computes the stack slot alignment from
    TYPE_MAIN_VARIANT, so for a typedef with attribute aligned the slot
    is only guaranteed to be 8-byte aligned and ix86_gimplify_va_arg emits
    no rounding of the overflow area pointer.  However, the final
    dereference is built with build_aligned_type (type, TYPE_ALIGN (type)),
    claiming the alignment of the typedef.  With optimization this results
    in aligned vector moves from a misaligned address.

    Clamp the alignment claimed for the access to the boundary the
    argument slot is actually placed at.  This also covers types whose
    alignment exceeds MAX_SUPPORTED_STACK_ALIGNMENT.

    Assisted-by: Claude Sonnet 5.5

    gcc/ChangeLog:

            PR target/127650
            * config/i386/i386.cc (ix86_gimplify_va_arg): Limit type_align
            to arg_boundary.

    gcc/testsuite/ChangeLog:

            PR target/127650
            * gcc.target/i386/pr127650.c: New test.

    (cherry picked from commit ef7d69b3a91c3b12a647ffca92e2553229f324dd)

Reply via email to