LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / Wstringop-overflow-5.c
blob4abce01b5f8f2a189cc8177273a9f49db8f1bc05
1 /* PR tree-optimization/85259 - Missing -Wstringop-overflow= since r256683
2 { dg-do compile }
3 { dg-options "-O2 -Wstringop-overflow" } */
5 extern char* strcpy (char*, const char*);
6 extern char* strcat (char*, const char*);
8 char a1[1];
9 char a2[2];
10 char a3[3];
11 char a4[4];
12 char a5[5];
13 char a6[6];
14 char a7[7];
15 char a8[8];
17 /* Verify that at least one instance of -Wstringop-overflow is issued
18 for each pair of strcpy/strcat calls. */
20 void test_strcpy_strcat_1 (void)
22 strcpy (a1, "1"), strcat (a1, "2"); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
25 void test_strcpy_strcat_2 (void)
27 strcpy (a2, "12"), strcat (a2, "3"); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
30 void test_strcpy_strcat_3 (void)
32 strcpy (a3, "123"), strcat (a3, "4"); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
35 void test_strcpy_strcat_4 (void)
37 strcpy (a4, "1234"), strcat (a4, "5"); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
40 void test_strcpy_strcat_5 (void)
42 strcpy (a5, "12345"), strcat (a5, "6"); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
45 void test_strcpy_strcat_6 (void)
47 strcpy (a6, "123456"), strcat (a6, "7"); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
50 void test_strcpy_strcat_7 (void)
52 strcpy (a7, "1234567"), strcat (a7, "8"); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
55 void test_strcpy_strcat_8 (void)
57 strcpy (a8, "12345678"), strcat (a8, "9"); /* { dg-warning "\\\[-Wstringop-overflow=]" } */