aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-07-20 16:38:43 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-07-20 10:38:43 -0600
commitcba563f71dbc137a6c0ba7c10bc8fef90203ea0c (patch)
treede51a23aef5e4ccf08a02a362a2242ef04584ca8
parent4a4412b9de23b153481a60cd69abcee71c3e34fb (diff)
downloadgcc-cba563f71dbc137a6c0ba7c10bc8fef90203ea0c.zip
gcc-cba563f71dbc137a6c0ba7c10bc8fef90203ea0c.tar.gz
gcc-cba563f71dbc137a6c0ba7c10bc8fef90203ea0c.tar.bz2
PR tree-optimization/86613 - missing -Warray-bounds on a wide string access due to ccp folding
PR tree-optimization/86613 - missing -Warray-bounds on a wide string access due to ccp folding PR tree-optimization/86611 - missing -Warray-bounds on a large negative index into a string in lp64 gcc/testsuite/ChangeLog: * gcc/testsuite/c-c++-common/Warray-bounds-2.c: Undefine macros and prune duplicate warnings. * gcc/testsuite/gcc.dg/Warray-bounds-31.c: Xfail test cases with data-model-dependencies. * gcc/testsuite/gcc.dg/Warray-bounds-32.c: Ditto. From-SVN: r262906
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/c-c++-common/Warray-bounds-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-31.c10
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-32.c3
4 files changed, 22 insertions, 7 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 10c547c..538c7c3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2018-07-20 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/86613
+ PR tree-optimization/86611
+ * gcc/testsuite/c-c++-common/Warray-bounds-2.c: Undefine macros and
+ prune duplicate warnings.
+ * gcc/testsuite/gcc.dg/Warray-bounds-31.c: Xfail test cases with
+ data-model-dependencies.
+ * gcc/testsuite/gcc.dg/Warray-bounds-32.c: Ditto.
+
2018-07-20 Richard Biener <rguenther@suse.de>
PR debug/86585
diff --git a/gcc/testsuite/c-c++-common/Warray-bounds-2.c b/gcc/testsuite/c-c++-common/Warray-bounds-2.c
index b7e61dd..da5f64d 100644
--- a/gcc/testsuite/c-c++-common/Warray-bounds-2.c
+++ b/gcc/testsuite/c-c++-common/Warray-bounds-2.c
@@ -11,6 +11,10 @@
#include <stddef.h>
#include <string.h>
+#undef memcpy
+#undef strcpy
+#undef strncpy
+
#define MAX (__SIZE_MAX__ / 2)
void sink (void*);
@@ -210,3 +214,5 @@ void call_strncpy_dstarray_diff_neg (const char *s, size_t n)
sink (&ar10);
}
+
+/* { dg-prune-output "outside array bounds" } */
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-31.c b/gcc/testsuite/gcc.dg/Warray-bounds-31.c
index e0be1e5..389afaf 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-31.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-31.c
@@ -23,7 +23,7 @@ void sink (int, ...);
void narrow_direct_cst (void)
{
- T (S1[MIN]); /* { dg-warning "array subscript -\[0-9\]+ is below array bounds of .char\\\[2]" "" { xfail *-*-* } } */
+ T (S1[MIN]); /* { dg-warning "array subscript -\[0-9\]+ is below array bounds of .char\\\[2]" "bug 86611" { xfail lp64 } } */
T (S1[-1]); /* { dg-warning "array subscript -1 is below array bounds of .char\\\[2]" } */
T (S1[0]);
T (S1[1]);
@@ -37,7 +37,7 @@ void narrow_direct_cst (void)
T (&S1[3]); /* { dg-warning "array subscript 3 is above array bounds of .char\\\[2]" } */
T (&S1[MAX]); /* { dg-warning "array subscript \[0-9\]+ is above array bounds of .char\\\[2]" } */
- T (S9[MIN]); /* { dg-warning "array subscript -\[0-9\]+ is below array bounds of .char\\\[10]" "" { xfail *-*-* } } */
+ T (S9[MIN]); /* { dg-warning "array subscript -\[0-9\]+ is below array bounds of .char\\\[10]" "xfail lp64" { xfail lp64 } } */
T (S9[-1]); /* { dg-warning "array subscript -1 is below array bounds of .char\\\[10]" } */
T (S9[9]);
T (S9[10]); /* { dg-warning "array subscript 10 is above array bounds of .char\\\[10]" } */
@@ -69,7 +69,7 @@ void narrow_ptr_index_cst (void)
{
const char *p = S7;
- T (p[MIN + 1]); /* { dg-warning "array subscript -\[0-9\]+ is outside array bounds of .char\\\[8]." "bug 84047" { xfail *-*-* } } */
+ T (p[MIN + 1]); /* { dg-warning "array subscript -\[0-9\]+ is outside array bounds of .char\\\[8]." "bug 86611" { xfail lp64 } } */
T (p[-1]); /* { dg-warning "array subscript -1 is outside array bounds of .char\\\[8]." } */
T (p[0]);
T (p[1]);
@@ -87,7 +87,7 @@ void narrow_ptr_index_cst (void)
T (&p[MAX]); /* { dg-warning "array subscript \[0-9\]+ is \(above|outside\) array bounds of .char\\\[8]." } */
const char *q = S8 + 4;
- T (q[MIN + 1]); /* { dg-warning "array subscript -?\[0-9\]+ is outside array bounds of .char\\\[9]." "bug 84047" { xfail *-*-* } } */
+ T (q[MIN + 1]); /* { dg-warning "array subscript -?\[0-9\]+ is outside array bounds of .char\\\[9]." "bug 86611" { xfail lp64 } } */
T (q[-5]); /* { dg-warning "array subscript -1 is outside array bounds of .char\\\[9]." } */
T (q[-4]);
T (q[0]);
@@ -97,7 +97,7 @@ void narrow_ptr_index_cst (void)
T (q[5]); /* { dg-warning "array subscript 9 is outside array bounds of .char\\\[9]." } */
T (q[99]); /* { dg-warning "array subscript 103 is outside array bounds of .char\\\[9]." } */
T (q[MAX - 4]); /* { dg-warning "array subscript \[0-9\]+ is outside array bounds of .char\\\[9]." } */
- T (q[MAX - 3]); /* { dg-warning "array subscript \[0-9\]+ is outside array bounds of .char\\\[9]." "bug 84047" { xfail *-*-* } } */
+ T (q[MAX - 3]); /* { dg-warning "array subscript -?\[0-9\]+ is outside array bounds of .char\\\[9]." "bug 86611" { xfail lp64 } } */
T (&q[MIN + 1]); /* { dg-warning "array subscript -?\[0-9\]+ is \(below|outside\) array bounds of .char\\\[9]." } */
T (&q[-5]); /* { dg-warning "array subscript -1 is \(below|outside\) array bounds of .char\\\[9]." } */
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-32.c b/gcc/testsuite/gcc.dg/Warray-bounds-32.c
index 9512764..54b09bc9 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-32.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-32.c
@@ -25,11 +25,10 @@ void sink (int);
void wide_direct_cst (void)
{
- T (W9[MIN]); /* { dg-warning "array subscript -\[0-9\]+ is below array bounds of .\[a-z \]+\\\[10]" "" } */
+ T (W9[MIN]); /* { dg-warning "array subscript -\[0-9\]+ is below array bounds of .\[a-z \]+\\\[10]" "bug 86611" { xfail ilp32 } } */
T (W9[-1]); /* { dg-warning "array subscript -1 is below array bounds of .\[a-z \]+\\\[10]" } */
T (W9[11]); /* { dg-warning "array subscript 11 is above array bounds of .\[a-z \]+\\\[10]" } */
T (W9[MAX]); /* { dg-warning "array subscript \[0-9\]+ is above array bounds of .\[a-z \]+\\\[10]" } */
-
}
void wide_ptr_deref_cst (void)