1 /* PR middle-end/92312 - bogus -Wstringop-overflow storing into a trailing
2 array backed by larger buffer
4 { dg-options "-O2 -Wall -Wno-array-bounds" } */
6 struct S0
{ char a
, b
[0]; };
10 void test_memset_zero_length (void)
13 struct S0
*p
= (struct S0
*)a
;
15 __builtin_memset (p
->b
, 0, 2);
18 __builtin_memset (p
->b
, 0, 3); // { dg-warning "\\\[-Wstringop-overflow" }
22 void test_store_zero_length (int i
)
25 struct S0
*p
= (struct S0
*)a
;
26 p
->a
= 0; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v4qi_store_align } } }
28 p
->b
[1] = 1; // { dg-bogus "\\\[-Wstringop-overflow" }
29 p
->b
[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { xfail { vect_slp_v4qi_store_align } } }
35 struct Sx
{ char a
, b
[]; };
37 void test_memset_flexarray (int i
)
40 struct Sx
*p
= (struct Sx
*)a
;
42 __builtin_memset (p
->b
, 0, 2);
45 __builtin_memset (p
->b
, 0, 3); // { dg-warning "\\\[-Wstringop-overflow" }
49 void test_store_flexarray (int i
)
52 struct Sx
*p
= (struct Sx
*)a
;
53 p
->a
= 0; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v4qi_store_align } } }
55 p
->b
[1] = 1; // { dg-bogus "\\\[-Wstringop-overflow" }
56 p
->b
[2] = 1; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { xfail { vect_slp_v4qi_store_align } } }