aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-06-21 14:54:47 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-06-21 14:54:47 +0000
commit4228997795917ab648bc7b58b9497e877ae8b92a (patch)
tree30178c30f5f53ba548194c129e6273ceb7ad0460
parent461a73b5789a77c47ddc54e02358d92e13486098 (diff)
downloadgcc-4228997795917ab648bc7b58b9497e877ae8b92a.zip
gcc-4228997795917ab648bc7b58b9497e877ae8b92a.tar.gz
gcc-4228997795917ab648bc7b58b9497e877ae8b92a.tar.bz2
re PR tree-optimization/32453 (ICE in build2_stat, at tree.c:3074 (extract_range_from_assert))
2007-06-21 Richard Guenther <rguenther@suse.de> PR tree-optimization/32453 * tree-vrp.c (extract_range_from_assert): Build POINTER_PLUS_EXPR for pointer anti-range. * gcc.c-torture/compile/pr32453.c: New testcase. From-SVN: r125922
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr32453.c11
-rw-r--r--gcc/tree-vrp.c5
4 files changed, 26 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2195e41..4e0d1dd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-06-21 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/32453
+ * tree-vrp.c (extract_range_from_assert): Build POINTER_PLUS_EXPR
+ for pointer anti-range.
+
2007-06-21 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c (processor_target_table): Increase maximum
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 81721f9..cdcf8fb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-21 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/32453
+ * gcc.c-torture/compile/pr32453.c: New testcase.
+
2007-06-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/31866
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32453.c b/gcc/testsuite/gcc.c-torture/compile/pr32453.c
new file mode 100644
index 0000000..bdabac7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr32453.c
@@ -0,0 +1,11 @@
+void ucs2reverse_internal_loop_single (long *irreversible, int foo)
+{
+ unsigned char bytebuf[2];
+ const unsigned char *inptr = bytebuf;
+ if (irreversible == (void *)0)
+ ;
+ else
+ inptr += 2;
+ if (inptr != bytebuf)
+ ((inptr - bytebuf > foo) ? (void) (0) : __assert_fail ());
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 8fba946..937a76b 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -1473,10 +1473,13 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
}
min = positive_overflow_infinity (TREE_TYPE (var_vr->min));
}
- else
+ else if (!POINTER_TYPE_P (TREE_TYPE (var_vr->min)))
min = fold_build2 (PLUS_EXPR, TREE_TYPE (var_vr->min),
anti_max,
build_int_cst (TREE_TYPE (var_vr->min), 1));
+ else
+ min = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (var_vr->min),
+ anti_max, size_int (1));
max = real_max;
set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv);
}