https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110298
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:0e332ee568739448a9439c7074d2a29badba60f2 commit r11-11141-g0e332ee568739448a9439c7074d2a29badba60f2 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.c (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)