https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124891
--- Comment #6 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:a133372acfb6f97f67c641916f686d906b7aba77 commit r16-8695-ga133372acfb6f97f67c641916f686d906b7aba77 Author: Jakub Jelinek <[email protected]> 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 <[email protected]> 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 <[email protected]>
