https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106041
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> --- Created attachment 54503 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54503&action=edit reduced testcase Reduced testcase (on the GCC 12 branch). Reduced with -O1 and diff --git a/gcc/dce.cc b/gcc/dce.cc index 6676cbcd429..8af54a96394 100644 --- a/gcc/dce.cc +++ b/gcc/dce.cc @@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "dbgcnt.h" #include "rtl-iter.h" +#include "diagnostic-core.h" /* ------------------------------------------------------------------------- @@ -1103,9 +1104,13 @@ fast_dce (bool word_level) dead_debug_global_init (&global_debug, NULL); + unsigned iters = 0; while (global_changed) { global_changed = false; + ++iters; + if (iters > 50) + internal_error ("too many iterations"); for (i = 0; i < n_blocks; i++) {