aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Warray-bounds-flex-arrays-2.c
diff options
context:
space:
mode:
authorQing Zhao <qing.zhao@oracle.com>2023-01-13 15:08:00 +0000
committerQing Zhao <qing.zhao@oracle.com>2023-01-13 15:08:00 +0000
commita3e8727b70f546dc82941391f3951188a0339e08 (patch)
treee5373b5b514284f10344daf67a0c693c44c26d38 /gcc/testsuite/gcc.dg/Warray-bounds-flex-arrays-2.c
parent450eb6b3b5b544d26da2535228ce03f9656a13a5 (diff)
downloadgcc-a3e8727b70f546dc82941391f3951188a0339e08.zip
gcc-a3e8727b70f546dc82941391f3951188a0339e08.tar.gz
gcc-a3e8727b70f546dc82941391f3951188a0339e08.tar.bz2
Replace flag_strict_flex_arrays with DECL_NOT_FLEXARRAY in middle-end.
We should not directly check flag_strict_flex_arrays in the middle end. Instead, check DECL_NOT_FLEXARRAY(array_field_decl) which is set by C/C++ FEs according to -fstrict-flex-arrays and the corresponding attribute attached to the array_field. As a result, We will lose the LEVEL information of -fstrict-flex-arrays in the middle end. -Wstrict-flex-arrays will not be able to issue such information. update the testing cases accordingly. gcc/ChangeLog: * attribs.cc (strict_flex_array_level_of): Move this function to ... * attribs.h (strict_flex_array_level_of): Remove the declaration. * gimple-array-bounds.cc (array_bounds_checker::check_array_ref): replace the referece to strict_flex_array_level_of with DECL_NOT_FLEXARRAY. * tree.cc (component_ref_size): Likewise. gcc/c/ChangeLog: * c-decl.cc (strict_flex_array_level_of): ... here. gcc/testsuite/ChangeLog: * gcc.dg/Warray-bounds-flex-arrays-1.c: Delete the level information from the message issued by -Wstrict-flex-arrays. * gcc.dg/Warray-bounds-flex-arrays-2.c: Likewise. * gcc.dg/Warray-bounds-flex-arrays-3.c: Likewise. * gcc.dg/Warray-bounds-flex-arrays-4.c: Likewise. * gcc.dg/Warray-bounds-flex-arrays-5.c: Likewise. * gcc.dg/Warray-bounds-flex-arrays-6.c: Likewise. * gcc.dg/Wstrict-flex-arrays-2.c: Likewise. * gcc.dg/Wstrict-flex-arrays-3.c: Likewise. * gcc.dg/Wstrict-flex-arrays.c: Likewise.
Diffstat (limited to 'gcc/testsuite/gcc.dg/Warray-bounds-flex-arrays-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-flex-arrays-2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-flex-arrays-2.c b/gcc/testsuite/gcc.dg/Warray-bounds-flex-arrays-2.c
index 2b5a895..55b7535 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-flex-arrays-2.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-flex-arrays-2.c
@@ -32,9 +32,9 @@ void __attribute__((__noinline__)) stuff(
struct trailing_array_4 *trailing_flex)
{
normal->c[5] = 5; /*{ dg-warning "array subscript 5 is above array bounds of" } */
- /*{ dg-warning "should not be used as a flexible array member for level 1 and above" "" { target *-*-* } .-1 } */
+ /*{ dg-warning "should not be used as a flexible array member" "" { target *-*-* } .-1 } */
trailing_1->c[2] = 2; /* { dg-warning "array subscript 2 is above array bounds of" } */
- /* { dg-warning "should not be used as a flexible array member for level 2 and above" "" { target *-*-* } .-1 } */
+ /* { dg-warning "should not be used as a flexible array member" "" { target *-*-* } .-1 } */
trailing_0->c[1] = 1; /* { dg-bogus "array subscript " } */
trailing_flex->c[10] = 10; /* { dg-bogus "array subscript " } */