https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108253
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Full backtrace: during GIMPLE pass: dom t.cc: In function ‘void TestBody()’: t.cc:46:1: internal compiler error: in set_nonzero_bits, at tree-ssanames.cc:464 46 | TestBody() { | ^~~~~~~~ 0x8f0a06 set_nonzero_bits(tree_node*, generic_wide_int<wide_int_ref_storage<false, true> > const&) /home/apinski/src/upstream-gcc-git/gcc/gcc/tree-ssanames.cc:464 0x14c8f23 maybe_set_nonzero_bits(edge_def*, tree_node*) /home/apinski/src/upstream-gcc-git/gcc/gcc/tree-vrp.cc:2456 0x1330c3b dom_opt_dom_walker::set_global_ranges_from_unreachable_edges(basic_block_def*) /home/apinski/src/upstream-gcc-git/gcc/gcc/tree-ssa-dom.cc:1383 0x1332586 dom_opt_dom_walker::before_dom_children(basic_block_def*) /home/apinski/src/upstream-gcc-git/gcc/gcc/tree-ssa-dom.cc:1652 0x1f80d1e dom_walker::walk(basic_block_def*) /home/apinski/src/upstream-gcc-git/gcc/gcc/domwalk.cc:311 0x1333251 execute /home/apinski/src/upstream-gcc-git/gcc/gcc/tree-ssa-dom.cc:939 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. That is maybe_set_nonzero_bits forgot to check if the cast was from a pointer type. I suspect (have not even tried this at all; figured this out via looking at the assert and looking at the current code) will fix this: diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc index e6c6c5a301d..8068cf2b083 100644 --- a/gcc/tree-vrp.cc +++ b/gcc/tree-vrp.cc @@ -762,6 +762,7 @@ maybe_set_nonzero_bits (edge e, tree var) tree cst; if (stmt == NULL + || POINTER_TYPE_P (TREE_TYPE (var)) || gimple_code (stmt) != GIMPLE_COND || gimple_cond_code (stmt) != ((e->flags & EDGE_TRUE_VALUE) ? EQ_EXPR : NE_EXPR)