summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-6.C30
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21559.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp17.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp18.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp23.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp24.c8
-rw-r--r--gcc/tree-vrp.c17
9 files changed, 76 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 24d22fae00f..4c69a8d84e7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2013-02-11 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/56273
+ * tree-vrp.c (simplify_cond_using_ranges): Disable for the
+ first VRP run.
+ (check_array_ref): Fix missing newline in dumps.
+ (search_for_addr_array): Likewise.
+
2013-02-09 David Edelsohn <dje.gcc@gmail.com>
* config/rs6000/aix61.h (OS_MISSING_ALTIVEC): Undefine.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 53cbcf85ac2..e21dbf7dd8f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2013-02-11 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/56273
+ * g++.dg/warn/Warray-bounds-6.C: New testcase.
+ * gcc.dg/tree-ssa/pr21559.c: Adjust.
+ * gcc.dg/tree-ssa/vrp17.c: Likewise.
+ * gcc.dg/tree-ssa/vrp18.c: Likewise.
+ * gcc.dg/tree-ssa/vrp23.c: Likewise.
+ * gcc.dg/tree-ssa/vrp24.c: Likewise.
+
2013-02-09 Uros Bizjak <ubizjak@gmail.com>
* g++.dg/asan/asan_test.C: Compile with -D__NO_INLINE__
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C
new file mode 100644
index 00000000000..ee2862f1ec1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-options "-O3 -Warray-bounds" }
+
+struct type {
+ bool a, b;
+ bool get_b() { return b; }
+};
+
+type stuff[9u];
+
+void bar();
+
+void foo() {
+
+ for(unsigned i = 0u; i < 9u; i++) {
+
+ if(!stuff[i].a) {
+ continue;
+ }
+
+ bar();
+
+ for(unsigned j = i + 1u; j < 9u; j++) {
+ if(stuff[j].a && stuff[j].get_b()) { // { dg-bogus "array bounds" }
+ return;
+ }
+ }
+
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
index 34f4a01db00..d7d3bab154d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1-details" } */
+/* { dg-options "-O2 -fdump-tree-vrp-details" } */
static int blocksize = 4096;
@@ -32,7 +32,7 @@ void foo (void)
/* First, we should simplify the bits < 0 test within the loop. */
-/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp2" } } */
/* Second, we should thread the edge out of the loop via the break
statement. We also realize that the final bytes == 0 test is useless,
@@ -40,4 +40,4 @@ void foo (void)
/* { dg-final { scan-tree-dump-times "Threaded jump" 3 "vrp1" } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
-
+/* { dg-final { cleanup-tree-dump "vrp2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp17.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp17.c
index c04b9ba7843..c501a7f338f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp17.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp17.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-vrp2" } */
extern void abort (void) __attribute__ ((__noreturn__));
union tree_node;
@@ -27,6 +27,5 @@ gimplify_for_stmt (tree stmt)
abort ();
}
-/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */
-/* { dg-final { cleanup-tree-dump "vrp1" } } */
-
+/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp2" } } */
+/* { dg-final { cleanup-tree-dump "vrp2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp18.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp18.c
index a3cc536ae56..610dd44cf2f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp18.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp18.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-vrp2" } */
static int blocksize = 4096;
@@ -30,5 +30,5 @@ void foo (void)
eof_reached = 1;
}
-/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */
-/* { dg-final { cleanup-tree-dump "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp2" } } */
+/* { dg-final { cleanup-tree-dump "vrp2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp23.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp23.c
index 77899a65fca..6bca02b44e1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp23.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp23.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1-details" } */
+/* { dg-options "-O2 -fdump-tree-vrp2-details" } */
blah (int code1, int code2)
{
@@ -40,6 +40,5 @@ L8:
/* The n_sets > 0 test can be simplified into n_sets == 1 since the
only way to reach the test is when n_sets <= 1, and the only value
which satisfies both conditions is n_sets == 1. */
-/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */
-/* { dg-final { cleanup-tree-dump "vrp1" } } */
-
+/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp2" } } */
+/* { dg-final { cleanup-tree-dump "vrp2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c
index 85e5b62d148..28e1a924f54 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c
@@ -1,6 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1-details" } */
-
+/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp2-details" } */
struct rtx_def;
typedef struct rtx_def *rtx;
@@ -86,6 +85,5 @@ L7:
The second n_sets > 0 test can also be simplified into n_sets == 1
as the only way to reach the tests is when n_sets <= 1 and the only
value which satisfies both conditions is n_sets == 1. */
-/* { dg-final { scan-tree-dump-times "Simplified relational" 2 "vrp1" } } */
-/* { dg-final { cleanup-tree-dump "vrp1" } } */
-
+/* { dg-final { scan-tree-dump-times "Simplified relational" 2 "vrp2" } } */
+/* { dg-final { cleanup-tree-dump "vrp2" } } */
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 0efac6045e3..a023a460371 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -6027,6 +6027,7 @@ check_array_ref (location_t location, tree ref, bool ignore_off_by_one)
{
fprintf (dump_file, "Array bound warning for ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, ref);
+ fprintf (dump_file, "\n");
}
warning_at (location, OPT_Warray_bounds,
"array subscript is above array bounds");
@@ -6039,6 +6040,7 @@ check_array_ref (location_t location, tree ref, bool ignore_off_by_one)
{
fprintf (dump_file, "Array bound warning for ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, ref);
+ fprintf (dump_file, "\n");
}
warning_at (location, OPT_Warray_bounds,
"array subscript is below array bounds");
@@ -6112,6 +6114,7 @@ search_for_addr_array (tree t, location_t location)
{
fprintf (dump_file, "Array bound warning for ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, t);
+ fprintf (dump_file, "\n");
}
warning_at (location, OPT_Warray_bounds,
"array subscript is below array bounds");
@@ -6125,6 +6128,7 @@ search_for_addr_array (tree t, location_t location)
{
fprintf (dump_file, "Array bound warning for ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, t);
+ fprintf (dump_file, "\n");
}
warning_at (location, OPT_Warray_bounds,
"array subscript is above array bounds");
@@ -8499,9 +8503,8 @@ test_for_singularity (enum tree_code cond_code, tree op0,
return NULL;
}
-/* Simplify a conditional using a relational operator to an equality
- test if the range information indicates only one value can satisfy
- the original conditional. */
+/* Simplify the conditional stmt STMT using final range information.
+ Return true if we simplified the statement. */
static bool
simplify_cond_using_ranges (gimple stmt)
@@ -8510,7 +8513,13 @@ simplify_cond_using_ranges (gimple stmt)
tree op1 = gimple_cond_rhs (stmt);
enum tree_code cond_code = gimple_cond_code (stmt);
- if (cond_code != NE_EXPR
+ /* Simplify a conditional using a relational operator to an equality
+ test if the range information indicates only one value can satisfy
+ the original conditional.
+ Do that only in the second VRP pass as otherwise assertions derived
+ from this predicate are weakened. */
+ if (!first_pass_instance
+ && cond_code != NE_EXPR
&& cond_code != EQ_EXPR
&& TREE_CODE (op0) == SSA_NAME
&& INTEGRAL_TYPE_P (TREE_TYPE (op0))