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

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

https://gcc.gnu.org/g:4f411e059595969d31fee76035369522e7d49be9

commit r17-5422-g4f411e059595969d31fee76035369522e7d49be9
Author: Merlin Warner-Huish <[email protected]>
Date:   Tue Oct 20 22:02:26 2026 -0600

    Re: [PATCH] phiopt: Fix successor check in spaceship_replacement [PR126566]

    After setting cond3_bb = single_pred (cond2_bb), spaceship_replacement
    checked that cond2_bb has two successors.  cond2_bb is already known to
    have two successors at that point; the check was meant for cond3_bb.
    When cond3_bb has a single successor, EDGE_SUCC (cond3_bb, 1) reads past
    the end of its successor vector, which ICEs with checking enabled.

    ---
     Bootstrapped and regression tested on x86_64-pc-linux-gnu with no new
     failures; the new test passes at all torture options.  Thanks to
     Kyrylo Tkachov for the analysis in the problem report.
            PR tree-optimization/126566

    gcc/ChangeLog:

            * tree-ssa-phiopt.cc (spaceship_replacement): Check the number of
            successors of cond3_bb rather than cond2_bb.

    gcc/testsuite/ChangeLog:

            * gcc.dg/torture/pr126566.c: New test.

Reply via email to