1 /* PR middle-end/79221 - missing -Wstringop-overflow= on a strcat overflow
2 { dg-do compile }
3 { dg-options "-O2 -Wall" } */
4
5 extern char* strcat (char*, const char*);
6
7 char d[3];
8
9 void f (int i)
10 {
11 const char *s = i < 0 ? "01234567" : "89abcd";
12 strcat (d, s); // { dg-warning "'strcat' writing between 7 and 9 bytes into a region of size 3" } */
13 }
14
15
16 void g (int i)
17 {
18 const char *s = i < 0 ? "12345678" : "87654321";
19 strcat (d, s); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
20 }