https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64083
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Seems I have an (untested) fix in my dev tree: Index: gcc/tree-ssa-threadupdate.c =================================================================== --- gcc/tree-ssa-threadupdate.c (revision 218078) +++ gcc/tree-ssa-threadupdate.c (working copy) @@ -2431,13 +2431,7 @@ thread_through_all_blocks (bool may_peel struct loop *loop = (*path)[0]->e->dest->loop_father; if (thread_block ((*path)[0]->e->dest, false)) - { - /* This jump thread likely totally scrambled this loop. - So arrange for it to be fixed up. */ - loop->header = NULL; - loop->latch = NULL; - e->aux = NULL; - } + e->aux = NULL; else { delete_jump_thread_path (path); or else it should use mark_loop_for_removal (loop). But the above is of course prefered.