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

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

https://gcc.gnu.org/g:fc2ee2f20c7f0b4439094435966a12eeead7197b

commit r16-6768-gfc2ee2f20c7f0b4439094435966a12eeead7197b
Author: Jakub Jelinek <[email protected]>
Date:   Wed Jan 14 15:53:44 2026 +0100

    combine: Partially revert the r12-4475 changes [PR120250]

    The r12-4475 change added extra code to recog_for_combine to attempt to
    force some constants into the constant pool.
    Unfortunately, as this (UB at runtime) testcase shows, such changes are
    harmful for computed_jump_p jumps.  The computed_jump_p returns false
    for loads from constant pool MEMs:
        case MEM:
          return ! (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
                    && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)));
    and so if we try to optimize a computed jump that way, it becomes
    a non-computed jump which doesn't match any other jump category
    (simplejump_p, tablejump_p, condjump_p, returnjump_p, eh_returnjump_p,
    asm goto) and doesn't have any label recorded in JUMP_LABEL (because,
    it doesn't really jump to any LABEL), so some passes like dwarf2cfi
    can get confused about it and ICE.

    The following patch just prevents that, by only doing the r12-4475
    changes if it is not a jump.

    2026-01-14  Jakub Jelinek  <[email protected]>

            PR target/120250
            * combine.cc (recog_for_combine): Don't try to put SET_SRC
            into a constant pool if SET_DEST is pc_rtx.

            * gcc.c-torture/compile/pr120250.c: New test.

Reply via email to