Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / Wstringop-overflow-8.c
blob513d6b1d332be3c5ed091b28cd2be762b59af2b0
1 /* PR tree-optimization/79220 - missing -Wstringop-overflow= on a memcpy
2 overflow with a small power-of-2 size
3 { dg-do compile }
4 { dg-options "-O2 -Wno-array-bounds -Wstringop-overflow" } */
6 extern void* memcpy (void*, const void*, __SIZE_TYPE__);
7 extern void* memmove (void*, const void*, __SIZE_TYPE__);
8 extern void* memset (void*, int, __SIZE_TYPE__);
10 char d[1];
12 void test_memcpy_lit_2 (void)
14 memcpy (d, "01", 2); /* { dg-warning "\\\[-Wstringop-overflow" } */
17 void test_memcpy_lit_4 (void)
19 memcpy (d, "0123", 4); /* { dg-warning "\\\[-Wstringop-overflow" } */
22 void test_memmove_lit_8 (void)
24 memmove (d, "01234567", 8); /* { dg-warning "\\\[-Wstringop-overflow" } */
28 void test_memcpy_ptr_2 (const void *s)
30 memcpy (d, s, 2); /* { dg-warning "\\\[-Wstringop-overflow" } */
33 void test_memcpy_ptr_4 (const void *s)
35 memcpy (d, s, 4); /* { dg-warning "\\\[-Wstringop-overflow" } */
38 void test_memcpy_ptr_8 (const void *s)
40 memcpy (d, s, 8); /* { dg-warning "\\\[-Wstringop-overflow" } */
44 void test_memmove_ptr (const void *s)
46 memmove (d, s, 8); /* { dg-warning "\\\[-Wstringop-overflow" } */
49 void test_memset_2 (void)
51 memset (d, 0, 2); /* { dg-warning "\\\[-Wstringop-overflow" } */
54 void test_memset_4 (void)
56 memset (d, 0, 4); /* { dg-warning "\\\[-Wstringop-overflow" } */
59 void test_memset_8 (void)
61 memset (d, 0, 8); /* { dg-warning "\\\[-Wstringop-overflow" } */