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

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

https://gcc.gnu.org/g:993c1e1d001556a6f831cad97ac629b748a27984

commit r17-6693-g993c1e1d001556a6f831cad97ac629b748a27984
Author: Uros Bizjak <[email protected]>
Date:   Wed Nov 25 09:43:38 2026 +0100

    i386: Pass aggregates with unaligned members in memory [PR128921]

    classify_argument checks for misaligned members only at scalar leaves.
    Two cases bypass that check.  A struct member whose only fields are
    bit-fields is classified as INTEGER without comparing its offset with
    TYPE_ALIGN of the member, and a _BitInt(N) member with N > 32 at a
    misaligned offset is routed into the aggregate path because WORDS
    includes the bit offset, which gives two INTEGER classes.  In both cases
    a packed struct is passed and returned in registers, while the psABI
    (3.2.3, classification, rule 1) requires class MEMORY for an object
    that contains unaligned fields.  The same happens for members of a
    packed union, whose alignment is lower than that of its members.

    Add misaligned_member_p, which checks the offset of an aggregate or
    _BitInt member against the natural alignment of its type, like the check
    of scalar members does with the mode alignment, and use it for the
    members of records and unions.  Add PSABI_UNALIGNED_MEMBER, so that
    -Wpsabi informs about the ABI change only for types whose
    classification actually changes.

    Assisted-by: Claude Sonnet 5.5

            PR target/128921

    gcc/ChangeLog:

            * config/i386/i386.cc (enum psabi_change)
            <PSABI_UNALIGNED_MEMBER>: New.
            (misaligned_member_p): New function.
            (inform_psabi_change): Handle PSABI_UNALIGNED_MEMBER.
            (classify_argument): Return 0 for a union member, or for a record
            member, for which misaligned_member_p returns true.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr128921-1.c: New test.
            * gcc.target/i386/pr128921-2.c: Ditto.
            * gcc.target/i386/pr128921-3.c: Ditto.
            * gcc.target/i386/pr128921-4.c: Ditto.
            * gcc.target/i386/pr128921-5.c: Ditto.
            * gcc.target/i386/pr128921-6.c: Ditto.
            * gcc.target/i386/pr128921-7.c: Ditto.
            * gcc.target/i386/pr128921-8.c: Ditto.
            * gcc.target/i386/pr128921-9.c: Ditto.
            * gcc.target/i386/pr128921-10.c: Ditto.
            * gcc.target/i386/pr128921-11.c: Ditto.
            * gcc.target/i386/pr128921-12.c: Ditto.
            * gcc.target/i386/pr128921-13.c: Ditto.
            * gcc.target/i386/pr128921-14.c: Ditto.
            * gcc.target/i386/pr128921-15.c: Ditto.

Reply via email to