aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-05 23:08:17 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-05 23:08:17 +0000
commitd710f1d7055d167536aade0b565995493c243e89 (patch)
treeb5ecd825862484f6a23bb12616f2fa286cf6c9a1
parente990c41790e4a67244908302bce923bd74f803e3 (diff)
svn merge -r120497:120507 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_1-branch
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_1-branch@120511 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr30212.c27
-rw-r--r--gcc/tree-vrp.c13
4 files changed, 44 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fd3381f28c2..93df8df4060 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-05 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/30212
+ * tree-vrp.c (adjust_range_with_scev): Do not adjust invalid
+ ranges by using TYPE_MIN_VALUE or TYPE_MAX_VALUE.
+
2006-05-22 Kazu Hirata <kazu@codesourcery.com>
PR target/27266
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8f5433a0c5c..c8c2d1bebbe 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-05 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/30212
+ * gcc.dg/torture/pr30212.c: New testcase.
+
2006-05-22 Kazu Hirata <kazu@codesourcery.com>
PR target/27266
diff --git a/gcc/testsuite/gcc.dg/torture/pr30212.c b/gcc/testsuite/gcc.dg/torture/pr30212.c
new file mode 100644
index 00000000000..a763135c226
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr30212.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+void test_crash (short *wb, int *dst)
+{
+ int is;
+ int i;
+
+ short *wBufSrc = wb;
+ int *iBufDst = dst;
+
+ for (i = 0; i < 2; i++)
+ {
+ is = (wBufSrc[ 0 > (i-1) ? 0 : (i -1 )]);
+
+ iBufDst[i] = is;
+ }
+}
+
+int main(int argc, char** argv)
+{
+ short wb [] = { 1, 2, 3 };
+ int in [] = { 4, 5, 6 };
+
+ test_crash(wb, in);
+
+ return 0;
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 0f3f673e38e..a1988c91a6b 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -1814,10 +1814,11 @@ adjust_range_with_scev (value_range_t *vr, struct loop *loop, tree stmt,
max = init;
/* If we just created an invalid range with the minimum
- greater than the maximum, take the minimum all the
- way to -INF. */
+ greater than the maximum, we fail conservatively.
+ This should happen only in unreachable
+ parts of code, or for invalid programs. */
if (compare_values (min, max) == 1)
- min = TYPE_MIN_VALUE (TREE_TYPE (min));
+ return;
}
}
else
@@ -1827,11 +1828,9 @@ adjust_range_with_scev (value_range_t *vr, struct loop *loop, tree stmt,
{
min = init;
- /* If we just created an invalid range with the minimum
- greater than the maximum, take the maximum all the
- way to +INF. */
+ /* Again, avoid creating invalid range by failing. */
if (compare_values (min, max) == 1)
- max = TYPE_MAX_VALUE (TREE_TYPE (max));
+ return;
}
}