https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111878
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tamar Christina <tnfch...@gcc.gnu.org>: https://gcc.gnu.org/g:7a496b7ce105185be12e023e749c90d5f7561879 commit r14-5529-g7a496b7ce105185be12e023e749c90d5f7561879 Author: Tamar Christina <tamar.christ...@arm.com> Date: Thu Nov 16 12:11:22 2023 +0000 middle-end: skip checking loop exits if loop malformed [PR111878] Before my refactoring if the loop->latch was incorrect then find_loop_location skipped checking the edges and would eventually return a dummy location. It turns out that a loop can have loops_state_satisfies_p (LOOPS_HAVE_RECORDED_EXITS) but also not have a latch in which case get_loop_exit_edges traps. This restores the old behavior. gcc/ChangeLog: PR tree-optimization/111878 * tree-vect-loop-manip.cc (find_loop_location): Skip edges check if latch incorrect. gcc/testsuite/ChangeLog: PR tree-optimization/111878 * gcc.dg/graphite/pr111878.c: New test.