1 /* Test derived from Glibc's getifaddrs_internal. The code could be
2 rewritten to avoid the warning for the memcpy call but since unions
3 are designed to have their members treated as interchangeable there
4 isn't a whole lot to be gained from issuing one.
6 { dg-options "-O2 -Wall" } */
8 typedef __SIZE_TYPE__
size_t;
10 extern void* memcpy (void*, const void*, size_t);
37 struct in_addr sin_addr
;
38 unsigned char sin_zero
[sizeof (struct sockaddr
) -
41 sizeof (struct in_addr
)];
49 struct in6_addr sin6_addr
;
56 struct sockaddr_in s4
;
57 struct sockaddr_in6 s6
;
62 void test_unconditional (void *p
)
65 memcpy (&((struct sockaddr_in6
*) sa
)->sin6_addr
, p
, 16);
68 void test_conditional (void *p
, int i
)
70 sa
= i
? &u1
.sa
: &u2
.sa
;
71 memcpy (&((struct sockaddr_in6
*) sa
)->sin6_addr
, p
, 16);