https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110298
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:9da2ef362fa8dc54df26c704a38dda40baee3ce9 commit r13-7469-g9da2ef362fa8dc54df26c704a38dda40baee3ce9 Author: Richard Biener <rguent...@suse.de> Date: Mon Jun 19 09:52:45 2023 +0200 tree-optimization/110298 - CFG cleanup and stale nb_iterations When unrolling we eventually kill nb_iterations info since it may refer to removed SSA names. But we do this only after cleaning up the CFG which in turn can end up accessing it. Fixed by swapping the two. PR tree-optimization/110298 * tree-ssa-loop-ivcanon.cc (tree_unroll_loops_completely): Clear number of iterations info before cleaning up the CFG. * gcc.dg/torture/pr110298.c: New testcase. (cherry picked from commit 916add3bf6e46467e4391e358b11ecfbc4daa275)