OSDN Git Service

2006-09-05 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Sep 2006 08:36:39 +0000 (08:36 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Sep 2006 08:36:39 +0000 (08:36 +0000)
PR tree-optimization/28905
* tree-vrp.c (fix_equivalence_set): Manually implement
!value_ranges_intersect_p to also handle symbolic ranges.

* gcc.c-torture/compile/pr28905.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116696 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr28905.c [new file with mode: 0644]
gcc/tree-vrp.c

index b4490c4..30a49bb 100644 (file)
@@ -1,5 +1,11 @@
 2006-09-05  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/28905
+       * tree-vrp.c (fix_equivalence_set): Manually implement
+       !value_ranges_intersect_p to also handle symbolic ranges.
+
+2006-09-05  Richard Guenther  <rguenther@suse.de>
+
        PR middle-end/28935
        * tree-ssa-ccp.c (fold_stmt_r): Make sure to fold the condition
        of a COND_EXPR.
index 1a4cda0..a1946dd 100644 (file)
@@ -1,5 +1,10 @@
 2006-09-05  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/28905
+       * gcc.c-torture/compile/pr28905.c: New testcase.
+
+2006-09-05  Richard Guenther  <rguenther@suse.de>
+
        PR middle-end/28935
        * gcc.dg/pr28935.c: New testcase.
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28905.c b/gcc/testsuite/gcc.c-torture/compile/pr28905.c
new file mode 100644 (file)
index 0000000..83a381a
--- /dev/null
@@ -0,0 +1,11 @@
+/* We used to ICE here because after VRP we ended up with
+   non-compatible ranges in a value-range equivalences set.  */
+void code_comment (int size)
+{
+  int i;
+  for (i = 0; i < size; i++)
+    if (i)
+      if (i < 0)
+        if (i < 0)
+          return;
+}
index 5f53211..a212744 100644 (file)
@@ -774,14 +774,18 @@ fix_equivalence_set (value_range_t *vr_p)
       value_range_t *equiv_vr = vr_value[i];
 
       if (equiv_vr->type == VR_VARYING
-         || equiv_vr->type == VR_UNDEFINED
-         || symbolic_range_p (equiv_vr))
+         || equiv_vr->type == VR_UNDEFINED)
        continue;
 
-      if (equiv_vr->type == VR_RANGE
-         && vr_p->type == VR_RANGE
-         && !value_ranges_intersect_p (vr_p, equiv_vr))
-       bitmap_set_bit (to_remove, i);
+      if (vr_p->type == VR_RANGE
+         && equiv_vr->type == VR_RANGE)
+       {
+         /* Two ranges have an empty intersection if their end points
+            are outside of the other range.  */
+         if (compare_values (equiv_vr->min, vr_p->max) == 1
+             || compare_values (equiv_vr->max, vr_p->min) == -1)
+           bitmap_set_bit (to_remove, i);
+       }
       else if ((equiv_vr->type == VR_RANGE && vr_p->type == VR_ANTI_RANGE)
               || (equiv_vr->type == VR_ANTI_RANGE && vr_p->type == VR_RANGE))
        {