[Bug tree-optimization/124891] [15 Regression] internal compiler error on trunk with -O3: tree check: expected ssa_name, have integer_cst in expand_simple_operations, at tree-ssa-loop-niter.cc:2885 since r15-80

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jun 1 20:54:32 GMT 2026


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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r15-11221-gf91e2ce3348941e24541861e55647267fc878c50
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 16 10:02:16 2026 +0200

    tree-ssa-propagate: Call update_stmt before folding [PR124891]

    The following testcase ICEs, because we
          did_replace |= substitute_and_fold_engine->replace_uses_in (stmt);
    and replace some SSA_NAME with INTEGER_CST and without update_stmt
    call fold_stmt.  Now fold_stmt ends up asking ranger about something end
    ICEs because it attempts to walk SSA_USE_OPs on that stmt and because
    we haven't updated the stmt, walks even the INTEGER_CST among ssa uses
    and checking ICEs because it attempts to test SSA_NAME flags on the
    INTEGER_CST.

    The following patch fixes it by calling update_stmt before folding in that
    case, it is called again after folding just in case it is folded.

    2026-04-16  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/124891
            * tree-ssa-propagate.cc
            (substitute_and_fold_dom_walker::before_dom_children): Call
update_stmt
            in the did_replace case before calling fold_stmt.

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

    Reviewed-by: Richard Biener <rguenth@suse.de>
    (cherry picked from commit a133372acfb6f97f67c641916f686d906b7aba77)


More information about the Gcc-bugs mailing list