Hi!

On the following testcase we ICE with -Os -Wtype-limits, as
VR_UNDEFINED has NULL vr0->min and vr0->max.  From what the code
does I believe the code only means to handle VR_RANGE and not anything else.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2015-01-12  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/64563
        * tree-vrp.c (vrp_evaluate_conditional): Check for VR_RANGE
        instead of != VR_VARYING.

        * gcc.dg/pr64563.c: New test.

--- gcc/tree-vrp.c.jj   2015-01-09 21:59:29.000000000 +0100
+++ gcc/tree-vrp.c      2015-01-12 11:21:50.363521200 +0100
@@ -7545,7 +7545,7 @@ vrp_evaluate_conditional (enum tree_code
       tree type = TREE_TYPE (op0);
       value_range_t *vr0 = get_value_range (op0);
 
-      if (vr0->type != VR_VARYING
+      if (vr0->type == VR_RANGE
          && INTEGRAL_TYPE_P (type)
          && vrp_val_is_min (vr0->min)
          && vrp_val_is_max (vr0->max)
--- gcc/testsuite/gcc.dg/pr64563.c.jj   2015-01-12 11:24:07.595145836 +0100
+++ gcc/testsuite/gcc.dg/pr64563.c      2015-01-12 11:23:08.000000000 +0100
@@ -0,0 +1,14 @@
+/* PR tree-optimization/64563 */
+/* { dg-do compile } */
+/* { dg-options "-Os -Wtype-limits" } */
+
+int a, b, c, d, f;
+unsigned int e;
+
+void
+foo (void)
+{
+  d = b = (a != (e | 4294967288UL));
+  if (!d)
+    c = f || b;
+}

        Jakub

Reply via email to