From cba563f71dbc137a6c0ba7c10bc8fef90203ea0c Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 20 Jul 2018 16:38:43 +0000 Subject: [PATCH] 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 --- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/c-c++-common/Warray-bounds-2.c | 6 ++++++ gcc/testsuite/gcc.dg/Warray-bounds-31.c | 10 +++++----- gcc/testsuite/gcc.dg/Warray-bounds-32.c | 3 +-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 10c547c7d14..538c7c3476b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2018-07-20 Martin Sebor + + 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 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 b7e61ddec23..da5f64df9b7 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 #include +#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 e0be1e598ed..389afaf045d 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 951276426a9..54b09bc9b98 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) -- 2.30.2