diff options
author | Martin Sebor <msebor@redhat.com> | 2020-01-20 14:53:33 +0100 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2020-01-20 14:53:33 +0100 |
commit | 414231ba78973dfcb11648a0a5287b989e0148bb (patch) | |
tree | 9ee516543ff69990b9695be895865402fe819189 /gcc | |
parent | a5d8a40617df40680cf7de6109925e4f1f1b9ae2 (diff) | |
download | gcc-414231ba78973dfcb11648a0a5287b989e0148bb.zip gcc-414231ba78973dfcb11648a0a5287b989e0148bb.tar.gz gcc-414231ba78973dfcb11648a0a5287b989e0148bb.tar.bz2 |
PR testsuite/92829 - several -Wstringop-overflow test case failures on powerpc64
* g++.dg/warn/Wstringop-overflow-4.C: Adjust test to avoid failures
due to an aparrent VRP limtation.
* gcc.dg/Wstringop-overflow-25.c: Same.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wstringop-overflow-25.c | 14 |
3 files changed, 28 insertions, 9 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 67d5f2e9..452c16e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2020-01-20 Martin Sebor <msebor@redhat.com> + + PR testsuite/92829 + * g++.dg/warn/Wstringop-overflow-4.C: Adjust test to avoid failures + due to an aparrent VRP limtation. + * gcc.dg/Wstringop-overflow-25.c: Same. + 2020-01-20 Nathan Sidwell <nathan@acm.org> PR preprocessor/80005 diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C index b6fe028..121239a 100644 --- a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C +++ b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C @@ -98,13 +98,19 @@ void test_strcpy_new_char_array (size_t n) #ifdef __INT16_TYPE__ +// Hack around PR 92829. +#define XUR(min, max) \ + (++idx, (vals[idx] < min || max < vals[idx] ? min : vals[idx])) + typedef __INT16_TYPE__ int16_t; -void test_strcpy_new_int16_t (size_t n) +void test_strcpy_new_int16_t (size_t n, const size_t vals[]) { - size_t r_0_1 = UR (0, 1); - size_t r_1_2 = UR (1, 2); - size_t r_2_3 = UR (2, 3); + size_t idx = 0; + + size_t r_0_1 = XUR (0, 1); + size_t r_1_2 = XUR (1, 2); + size_t r_2_3 = XUR (2, 3); T (S (0), new int16_t[r_0_1]); T (S (1), new int16_t[r_0_1]); @@ -122,7 +128,7 @@ void test_strcpy_new_int16_t (size_t n) T (S (6), new int16_t[r_2_3]); // { dg-warning "\\\[-Wstringop-overflow" } T (S (9), new int16_t[r_2_3]); // { dg-warning "\\\[-Wstringop-overflow" } - size_t r_2_smax = UR (2, SIZE_MAX); + size_t r_2_smax = XUR (2, SIZE_MAX); T (S (0), new int16_t[r_2_smax]); T (S (1), new int16_t[r_2_smax]); T (S (2), new int16_t[r_2_smax]); diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-25.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-25.c index 1b38dfe..0180720 100644 --- a/gcc/testsuite/gcc.dg/Wstringop-overflow-25.c +++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-25.c @@ -290,11 +290,17 @@ NOIPA void test_strcpy_alloc2_4 (void) sink (vla); \ } while (0) -NOIPA void test_strcpy_vla (void) +// Hack around PR 92829. +#define XUR(min, max) \ + (++idx, (vals[idx] < min || max < vals[idx] ? min : vals[idx])) + +NOIPA void test_strcpy_vla (const size_t vals[]) { - size_t r_0_1 = UR (0, 1); - size_t r_1_2 = UR (1, 2); - size_t r_2_3 = UR (2, 3); + size_t idx = 0; + + size_t r_0_1 = XUR (0, 1); + size_t r_1_2 = XUR (1, 2); + size_t r_2_3 = XUR (2, 3); T (char, S (0), r_0_1); T (char, S (1), r_0_1); // { dg-warning "\\\[-Wstringop-overflow" } |