Hi! int_fits_type_p ICEs if the second argument is pointer type (those don't have TYPE_MIN_VALUE/TYPE_MAX_VALUE). Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2013-05-21 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/57331 * tree-vrp.c (simplify_cond_using_ranges): Don't optimize comparison of conversion from pointer type to integral type with integer. * gcc.c-torture/compile/pr57331.c: New test. --- gcc/tree-vrp.c.jj 2013-05-04 14:35:01.000000000 +0200 +++ gcc/tree-vrp.c 2013-05-21 12:07:33.382917422 +0200 @@ -8661,7 +8661,8 @@ simplify_cond_using_ranges (gimple stmt) innerop = gimple_assign_rhs1 (def_stmt); - if (TREE_CODE (innerop) == SSA_NAME) + if (TREE_CODE (innerop) == SSA_NAME + && !POINTER_TYPE_P (TREE_TYPE (innerop))) { value_range_t *vr = get_value_range (innerop); --- gcc/testsuite/gcc.c-torture/compile/pr57331.c.jj 2013-05-21 12:08:11.859697048 +0200 +++ gcc/testsuite/gcc.c-torture/compile/pr57331.c 2013-05-21 12:06:27.000000000 +0200 @@ -0,0 +1,11 @@ +/* PR tree-optimization/57331 */ + +int +foo (int x) +{ + void *p = x ? (void *) 1 : (void *) 0; + __INTPTR_TYPE__ b = (__INTPTR_TYPE__) p; + if (b) + return 0; + return 1; +} Jakub