1 /* PR middle-end/96963 - -Wstringop-overflow false positive with
2 -ftree-vectorize when assigning consecutive char struct members
4 { dg-options "-O2 -Wall -ftree-vectorize" } */
15 void nowarn_char_assign (struct Char
*p
)
19 /* Verify the bogus warning triggered by the tree-ssa-strlen.c pass
21 p
->c
= 1; // { dg-bogus "\\\[-Wstringop-overflow" }
27 void nowarn_char_array_assign (struct Char
*p
)
31 p
->a
[0] = 1; // { dg-bogus "\\\[-Wstringop-overflow" }
37 void warn_char_array_assign_interior (struct Char
*p
)
43 #pragma GCC diagnostic push
44 #pragma GCC diagnostic ignored "-Warray-bounds"
45 /* Warnings are only suppressed for trailing arrays. Verify
46 one is issued for an interior array. */
47 p
->a
[2] = 5; // { dg-warning "\\\[-Wstringop-overflow" }
48 #pragma GCC diagnostic pop
51 void warn_char_array_assign_trailing (struct Char
*p
)
53 /* This is separated from warn_char_array_assign_interior because
54 otherwise GCC removes the store to p->a[2] as dead since it's
55 overwritten by p->b[0]. */
60 #pragma GCC diagnostic push
61 #pragma GCC diagnostic ignored "-Warray-bounds"
62 /* Warnings are only suppressed for trailing arrays with at most
63 one element. Verify one is issued for a two-element array. */
64 p
->b
[2] = 5; // { dg-warning "\\\[-Wstringop-overflow" }
65 #pragma GCC diagnostic pop
69 /* Also verify there's no warning for other types than char (even though
70 the problem was limited to chars and -Wstringop-overflow should only
71 trigger for character accesses). */
80 void nowarn_short_assign (struct Short
*p
)
90 void nowarn_short_array_assign (struct Short
*p
)