Implement C _FloatN, _FloatNx types.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr53703.c
blobc9e10abf594fccf3338cea58a07823103305e4c4
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;
8 struct sockaddr {};
9 typedef unsigned char __u8;
10 typedef unsigned short __u16;
11 typedef unsigned int __u32;
12 struct nlmsghdr {
13 __u32 nlmsg_len;
14 __u16 nlmsg_type;
16 struct ifaddrmsg {
17 __u8 ifa_family;
19 enum {
20 IFA_ADDRESS,
21 IFA_LOCAL,
23 enum {
24 RTM_NEWLINK = 16,
25 RTM_NEWADDR = 20,
27 struct rtattr {
28 unsigned short rta_len;
29 unsigned short rta_type;
31 struct ifaddrs {
32 struct ifaddrs *ifa_next;
33 unsigned short ifa_flags;
35 typedef unsigned short int uint16_t;
36 typedef unsigned int uint32_t;
37 struct nlmsg_list {
38 struct nlmsg_list *nlm_next;
39 int size;
41 struct rtmaddr_ifamap {
42 void *address;
43 void *local;
44 int address_len;
45 int local_len;
47 int usagi_getifaddrs (struct ifaddrs **ifap)
49 struct nlmsg_list *nlmsg_list, *nlmsg_end, *nlm;
50 size_t dlen, xlen, nlen;
51 int build;
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;
61 for (nlh = nlh0;
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)
68 & ~(4U -1) ))))
70 struct ifinfomsg *ifim = ((void *)0);
71 struct ifaddrmsg *ifam = ((void *)0);
72 struct rtattr *rta;
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)
78 case RTM_NEWLINK:
79 ifim = (struct ifinfomsg *)
80 ((void*)(((char*)nlh)
81 + ((0)+( ((((int)
82 ( ((sizeof(struct nlmsghdr))+4U -1)
83 & ~(4U -1) )))+4U -1)
84 & ~(4U -1) ))));
85 case RTM_NEWADDR:
86 ifam = (struct ifaddrmsg *)
87 ((void*)(((char*)nlh)
88 + ((0)+( ((((int)
89 ( ((sizeof(struct nlmsghdr))+4U -1)
90 & ~(4U -1) )))+4U -1)
91 & ~(4U -1) ))));
92 nlm_family = ifam->ifa_family;
93 if (build)
94 ifa->ifa_flags = ifflist[nlm_index];
95 break;
96 default:
97 continue;
99 if (!build)
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)
106 & ~(4 -1) ) + (0)));
107 switch (nlh->nlmsg_type)
109 case RTM_NEWLINK:
110 break;
111 case RTM_NEWADDR:
112 if (nlm_family == 17)
113 break;
114 switch (rta->rta_type)
116 case IFA_ADDRESS:
117 ifamap.address = rtadata;
118 ifamap.address_len = rtapayload;
119 case IFA_LOCAL:
120 ifamap.local = rtadata;
124 if (nlh->nlmsg_type == RTM_NEWADDR && nlm_family != 17)
126 if (!ifamap.local)
128 ifamap.local = ifamap.address;
129 ifamap.local_len = ifamap.address_len;
131 if (!ifamap.address)
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)))
140 if (!build)
141 dlen += (((ifa_sa_len (nlm_family,
142 ifamap.address_len))+4U -1)
143 & ~(4U -1) );