https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106422
--- Comment #14 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- Created attachment 53373 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53373&action=edit Untested patch The important part is the change to tree-ssa-threadupdate.cc. The rest is just making sure the backward threader doesn't print out "SUCCESS" when a path was actually dropped. With this patch I see all threaders find and successfully drop this path (with no ICE ;-)): grep 'Found block' a.c.* a.c.036t.ethread:Found block that cannot be duplicated: Cancelling jump thread: (2, 5) incoming edge; (5, 7) nocopy; a.c.114t.threadfull1:Found block that cannot be duplicated: Cancelling jump thread: (2, 4) incoming edge; (4, 6) nocopy; a.c.114t.threadfull1:Found block that cannot be duplicated: Cancelling jump thread: (0, 2) incoming edge; (2, 4) normal (4, 6) nocopy; a.c.129t.thread1:Found block that cannot be duplicated: Cancelling jump thread: (2, 4) incoming edge; (4, 6) nocopy; a.c.129t.thread1:Found block that cannot be duplicated: Cancelling jump thread: (0, 2) incoming edge; (2, 4) normal (4, 6) nocopy; a.c.130t.dom2:Found block that cannot be duplicated: Cancelling jump thread: (2, 4) incoming edge; (4, 6) normal; a.c.195t.thread2:Found block that cannot be duplicated: Cancelling jump thread: (2, 5) incoming edge; (5, 7) nocopy; a.c.195t.thread2:Found block that cannot be duplicated: Cancelling jump thread: (0, 2) incoming edge; (2, 5) normal (5, 7) nocopy; a.c.196t.dom3:Found block that cannot be duplicated: Cancelling jump thread: (2, 5) incoming edge; (5, 7) normal; a.c.198t.threadfull2:Found block that cannot be duplicated: Cancelling jump thread: (2, 5) incoming edge; (5, 7) nocopy; a.c.198t.threadfull2:Found block that cannot be duplicated: Cancelling jump thread: (0, 2) incoming edge; (2, 5) normal (5, 7) nocopy; Perhaps someone can take this over, and maybe clean up the duplicity in cancel_invalid_paths. We should probably call can_duplicate_block_p for the SRC and then the final destination block outside the loop.