aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wstringop-overflow-40.c
diff options
context:
space:
mode:
authorMartin Uecker <uecker@tugraz.at>2023-04-13 19:35:15 +0200
committerMartin Uecker <uecker@tugraz.at>2023-11-03 23:20:39 +0100
commit6e9ee44d96e5bda8808dd9d8ccf58d2525383f6b (patch)
tree357a172ed0e579530aad437cedb5e702c35fdbdc /gcc/testsuite/gcc.dg/Wstringop-overflow-40.c
parent5340f48b7639fcc874f64aac214f9ef9ae43d43e (diff)
downloadgcc-6e9ee44d96e5bda8808dd9d8ccf58d2525383f6b.zip
gcc-6e9ee44d96e5bda8808dd9d8ccf58d2525383f6b.tar.gz
gcc-6e9ee44d96e5bda8808dd9d8ccf58d2525383f6b.tar.bz2
Reduce false positives for -Wnonnull for VLA parameters [PR98541]
This patch limits the warning about NULL arguments to VLA parameters declared [static n]. PR c/98541 gcc/ * gimple-ssa-warn-access.cc (pass_waccess::maybe_check_access_sizes): For VLA bounds in parameters, only warn about null pointers with 'static'. gcc/testsuite: * gcc.dg/Wnonnull-4.c: Adapt test. * gcc.dg/Wstringop-overflow-40.c: Adapt test.
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wstringop-overflow-40.c')
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-40.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-40.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-40.c
index 386c92d..9e0ad1f 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-40.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-40.c
@@ -11,6 +11,7 @@ void fxa2 (int16_t[2]) __attribute__ ((nonnull));
void fas2 (int16_t[static 2]);
void fvla (unsigned n, int16_t[n]);
+void fvlaS (unsigned n, int16_t[static n]);
void test_array_1_dim (void)
{
@@ -33,7 +34,8 @@ void test_array_1_dim (void)
fas2 (a1); // { dg-warning "'fas2' accessing 4 bytes in a region of size 2 " }
fas2 (&i); // { dg-warning "'fas2' accessing 4 bytes in a region of size 2 " }
- fvla (1, 0); // { dg-warning "\\\[-Wnonnull" }
+ fvla (1, 0);
+ fvlaS (1, 0); // { dg-warning "\\\[-Wnonnull" }
fvla (1, &i);
fvla (2, a2);
fvla (2, a1); // { dg-warning "'fvla' accessing 4 bytes in a region of size 2 " }
@@ -47,6 +49,7 @@ void fxac2 (const int16_t[2]) __attribute__ ((nonnull));
void facs2 (const int16_t[static 2]);
void fvlac (unsigned n, const int16_t[n]);
+void fvlacS (unsigned n, const int16_t[static n]);
void test_const_array_1_dim (void)
{
@@ -69,7 +72,8 @@ void test_const_array_1_dim (void)
facs2 (a1); // { dg-warning "'facs2' reading 4 bytes from a region of size 2 " }
facs2 (&i); // { dg-warning "'facs2' reading 4 bytes from a region of size 2 " }
- fvlac (1, 0); // { dg-warning "\\\[-Wnonnull" }
+ fvlac (1, 0);
+ fvlacS (1, 0); // { dg-warning "\\\[-Wnonnull" }
fvlac (1, &i);
fvlac (2, a2);
fvlac (2, a1); // { dg-warning "'fvlac' reading 4 bytes from a region of size 2 " }