https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100934
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Richard Biener from comment #8) > --- a/gcc/tree-ssa-threadupdate.c > +++ b/gcc/tree-ssa-threadupdate.c > @@ -2379,12 +2379,15 @@ jump_thread_path_registry::duplicate_thread_path > (edge entry, > missuses of the functions. I.e. if you ask to copy something weird, > it will work, but the state of structures probably will not be > correct. */ > + bool loop_header_duplicated = false; > for (i = 0; i < n_region; i++) > { > /* We do not handle subloops, i.e. all the blocks must belong to the > same loop. */ > if (region[i]->loop_father != loop) > return false; > + if (region[i]->loop_father == loop) > + loop_header_duplicated = true; The if right above this returns false if loop_father is not loop, so wouldn't be loop_header_duplicated == true whenever n_region != 0 (or always)?