1 /* Reduced test case from PR53703. Used to ICE. */
3 /* { dg-do compile } */
4 /* { dg-options "-w" } */
6 typedef long unsigned int size_t;
7 typedef unsigned short int sa_family_t;
9 typedef unsigned char __u8;
10 typedef unsigned short __u16;
11 typedef unsigned int __u32;
28 unsigned short rta_len;
29 unsigned short rta_type;
32 struct ifaddrs *ifa_next;
33 unsigned short ifa_flags;
35 typedef unsigned short int uint16_t;
36 typedef unsigned int uint32_t;
38 struct nlmsg_list *nlm_next;
41 struct rtmaddr_ifamap {
47 int usagi_getifaddrs (struct ifaddrs **ifap)
49 struct nlmsg_list *nlmsg_list, *nlmsg_end, *nlm;
50 size_t dlen, xlen, nlen;
52 for (build = 0; build <= 1; build++)
54 struct ifaddrs *ifl = ((void *)0), *ifa = ((void *)0);
55 struct nlmsghdr *nlh, *nlh0;
56 uint16_t *ifflist = ((void *)0);
57 struct rtmaddr_ifamap ifamap;
58 for (nlm = nlmsg_list; nlm; nlm = nlm->nlm_next)
60 int nlmlen = nlm->size;
62 ((nlmlen) >= (int)sizeof(struct nlmsghdr)
63 && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr)
64 && (nlh)->nlmsg_len <= (nlmlen));
65 nlh = ((nlmlen) -= ( (((nlh)->nlmsg_len)+4U -1) & ~(4U -1) ),
66 (struct nlmsghdr*)(((char*)(nlh))
67 + ( (((nlh)->nlmsg_len)+4U -1)
70 struct ifinfomsg *ifim = ((void *)0);
71 struct ifaddrmsg *ifam = ((void *)0);
73 sa_family_t nlm_family = 0;
74 uint32_t nlm_scope = 0, nlm_index = 0;
75 memset (&ifamap, 0, sizeof (ifamap));
76 switch (nlh->nlmsg_type)
79 ifim = (struct ifinfomsg *)
82 ( ((sizeof(struct nlmsghdr))+4U -1)
86 ifam = (struct ifaddrmsg *)
89 ( ((sizeof(struct nlmsghdr))+4U -1)
92 nlm_family = ifam->ifa_family;
94 ifa->ifa_flags = ifflist[nlm_index];
101 void *rtadata = ((void*)(((char*)(rta))
102 + (( ((sizeof(struct rtattr))+4 -1)
103 & ~(4 -1) ) + (0))));
104 size_t rtapayload = ((int)((rta)->rta_len)
105 - (( ((sizeof(struct rtattr))+4 -1)
107 switch (nlh->nlmsg_type)
112 if (nlm_family == 17)
114 switch (rta->rta_type)
117 ifamap.address = rtadata;
118 ifamap.address_len = rtapayload;
120 ifamap.local = rtadata;
124 if (nlh->nlmsg_type == RTM_NEWADDR && nlm_family != 17)
128 ifamap.local = ifamap.address;
129 ifamap.local_len = ifamap.address_len;
133 ifamap.address = ifamap.local;
135 if (ifamap.address_len != ifamap.local_len
136 || (ifamap.address != ((void *)0)
137 && memcmp (ifamap.address, ifamap.local,
138 ifamap.address_len)))
141 dlen += (((ifa_sa_len (nlm_family,
142 ifamap.address_len))+4U -1)