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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <[email protected]>:

https://gcc.gnu.org/g:3ec1d59c1705a21398076893d19e25ac18ff24a5

commit r16-7050-g3ec1d59c1705a21398076893d19e25ac18ff24a5
Author: Andrew Pinski <[email protected]>
Date:   Sun Jan 25 15:08:31 2026 -0800

    final: Fix out of bounds access for invalid asm operands [PR123709]

    output_asm_insn has an out of bounds array access if the supplied
    operand number in the inline-asm is "big" (>=MAX_RECOG_OPERANDS).
    This makes it so that there is no longer an out of bounds access
    by increasing the two arrays by one and using the last element as
    the fake location for all out of range operands.

    This could be a regression because r0-38026-g4f9b4029463bc0 seems like
    introduce the out of bounds access but

    Bootstrapped and tested on x86_64-linux-gnu.

            PR middle-end/123709

    gcc/ChangeLog:

            * final.cc (output_asm_operand_names): Skip over
            opnum which is MAX_RECOG_OPERANDS (invalid).
            (output_asm_insn): Increase opoutput and oporder size
            by 1. For out of range operands, set the opnum to
            MAX_RECOG_OPERANDS.

    gcc/testsuite/ChangeLog:

            * c-c++-common/asm-invalid-operand-1.c: New test.

    Signed-off-by: Andrew Pinski <[email protected]>

Reply via email to