1 /* PR middle-end/93829 - bogus -Wstringop-overflow on memcpy of a struct
2 with a pointer member from another with a long string
4 { dg-options "-O2 -Wall" } */
6 extern void* memcpy (void*, const void*, __SIZE_TYPE__
);
8 #define S40 "0123456789012345678901234567890123456789"
10 const char s40
[] = S40
;
14 const void *p
, *q
, *r
;
18 void test_lit_decl (void)
20 struct S t
= { 0, S40
, 0 };
22 memcpy (&s
, &t
, sizeof t
); // { dg-bogus "-Wstringop-overflow" }
25 void test_str_decl (void)
27 struct S t
= { 0, s40
, 0 };
29 memcpy (&s
, &t
, sizeof t
); // { dg-bogus "-Wstringop-overflow" }
33 void test_lit_ssa (int i
)
38 struct S t
= { 0, S40
, 0 };
40 memcpy (p
, &t
, sizeof t
); // { dg-bogus "-Wstringop-overflow" }
43 void test_str_ssa (int i
)
48 struct S t
= { 0, s40
, 0 };
50 memcpy (p
, &t
, sizeof t
); // { dg-bogus "-Wstringop-overflow" }