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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
We should make mark_loop_for_removal more robust then, I am testing

Index: gcc/cfgloop.c
===================================================================
--- gcc/cfgloop.c       (revision 218733)
+++ gcc/cfgloop.c       (working copy)
@@ -1928,9 +1928,10 @@ bb_loop_depth (const_basic_block bb)
 void
 mark_loop_for_removal (loop_p loop)
 {
+  if (loop->header == NULL)
+    return;
   loop->former_header = loop->header;
   loop->header = NULL;
   loop->latch = NULL;
   loops_state_set (LOOPS_NEED_FIXUP);
 }

I suppose extracting a testcase for this is too hard?

Reply via email to