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

--- Comment #5 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:92a95b5e20929eb363f849170236271ce6973b43

commit r17-6320-g92a95b5e20929eb363f849170236271ce6973b43
Author: Uros Bizjak <[email protected]>
Date:   Mon Nov 16 09:11:07 2026 +0100

    i386: Don't advance over empty class on the stack in
function_arg_advance_64 [PR128751]

    An empty class containing only an unnamed bit-field has TYPE_EMPTY_P set,
    so the generic argument layout (expand_call, locate_and_pad_parm) gives
    it zero bytes on the stack.  However, classify_argument gives such a class
    an INTEGER class, and when no integer register is left,
    function_arg_advance_64 falls into the stack branch and adds one word to
    cum->words.  ix86_va_start then computes overflow_arg_area one slot too
    far, and va_arg in the callee disagrees with the caller.

    Don't advance cum->words for TYPE_EMPTY_P arguments, consistently with
    ix86_function_arg_boundary which already special-cases them.

    Assisted-by: Claude Sonnet 5.5

            PR target/128751

    gcc/ChangeLog:

            * config/i386/i386.cc (function_arg_advance_64): Do not advance
            cum->words for TYPE_EMPTY_P arguments passed on the stack.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr128751.c: New test.

Reply via email to