]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/Wstringop-overflow-15.c
1 /* PR middle-end/91458 - inconsistent warning for writing past the end
3 Verify that the -Wstringop-overflow detection doesn't cause an ICE
4 for either kind of VLAs (member and non-member).
5 Diagnosing the accesses is the subject of pr82608.
7 { dg-options "-O2 -Wall -Wno-array-bounds" }
8 { dg-require-effective-target alloca } */
12 void vla_unbounded (int n
)
18 a
[n
] = n
; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" { xfail *-*-* } }
23 void vla_bounded (int n
)
36 a
[n
] = n
; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" { xfail *-*-* } }
37 a
[32] = 32; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" }
38 a
[69] = 69; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" }
44 void member_vla_unbounded (int n
)
46 struct S
{ char i
, a
[n
]; } s
;
50 s
.a
[n
] = n
; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" { xfail *-*-* } }
55 void member_vla_bounded (int n
)
60 struct S
{ char i
, a
[n
]; } s
;
68 s
.a
[n
] = n
; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" { xfail *-*-* } }
69 s
.a
[32] = 32; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" }
70 s
.a
[69] = 69; // { dg-warning "\\\[-Wstringop-overflow" "pr82608" }