https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106936
--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- This assert was put here to make sure that the legacy get_value_range() wasn't being called on stuff that legacy couldn't handle (floats, etc), because the result would ultimately be copied into a value_range_equiv. In this case, simplify_casted_cond() is calling it on an offset_type which isn't either an integer nor a pointer, so the assert is failing. However, range_of_expr happily punted on it because it couldn't handle it, so we're just returning VARYING. As value_range_equiv can store VARYING types of anything (including types it can't handle), this is fine. I think the easiest thing to do is remove the assert. If someone from the non legacy world tries to get a non integer/pointer range here, it's going to blow up anyhow because the temporary in get_value_range is int_range_max. Anywho. This should do the trick. I'm in transit to Cauldron. Could someone test and push this? I'd hate to leave what looks like an ICE on valid code open. diff --git a/gcc/value-query.cc b/gcc/value-query.cc index 06ad5fe9708..0bdd670982b 100644 --- a/gcc/value-query.cc +++ b/gcc/value-query.cc @@ -167,7 +167,6 @@ range_query::free_value_range_equiv (value_range_equiv *v) const class value_range_equiv * range_query::get_value_range (const_tree expr, gimple *stmt) { - gcc_checking_assert (value_range_equiv::supports_p (TREE_TYPE (expr))); int_range_max r; if (range_of_expr (r, const_cast<tree> (expr), stmt)) return new (equiv_alloc->allocate ()) value_range_equiv (r);