------- Additional Comments From kazu at cs dot umass dot edu 2005-04-14 15:51 ------- Before VRP (even before ASSERT_EXPR insertion), we have
const void * r; unsigned int D.1157; void * D.1156; : : if (r_3 >= D.1157_5) goto <L0>; else goto <L5>; Note that we already have a type-mismatched comparison - an integer v.s. a pointer. tree-vrp.c:maybe_add_assert_expr inserts the following ASSERT_EXPR in the "else" branch of the "if" statement. r_14 = ASSERT_EXPR <r_3, r_3 < D.1157_5>; Eventually the propagation engine visits this ASSERT_EXPR with a call tree like so. simulate_stmt vrp_visit_stmt vrp_visit_assignment extract_range_from_expr extract_range_from_assert (ASSERT_EXPR <r_3, r_3 < D.1157_5>) value_ranges_intersect_p ([D.1156_2, D.1156_2], [0, D.1157_5 - 1]) value_inside_range (D.1157_5 - 1, [D.1156_2, D.1156_2]) compare_values (D.1157_5 - 1, D.1156_2) compare_values does some limited symbolic comparisons. In this case, it checks whether D.1156_2 == INF so that if that's the case, we can deduce that D.1157_5 - 1 < D.1156_2 But we cannot compute TYPE_MAX_VALUE (TREE_TYPE (D.1156_2)) because D.1156_2 is of a pointer type, causing the ICE. The root cause of the problem is that we have a type-mismatched comparison. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21021