2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr59350.c
blobfa632454ae1e86df77bda7b213b37a92545012c0
1 /* PR debug/59350 */
2 /* Testcase by Ryan Mansfield <rmansfield@qnx.com> */
4 /* { dg-do compile } */
5 /* { dg-options "-O -g" } */
7 typedef union
9 char b[2];
10 short NotAnInteger;
12 mDNSOpaque16;
13 typedef mDNSOpaque16 mDNSIPPort;
14 typedef struct
17 mDNSAddr;
18 typedef struct DNSQuestion_struct DNSQuestion;
19 typedef struct mDNS_struct mDNS;
20 typedef struct __attribute__ ((__packed__))
22 mDNSOpaque16 id;
23 mDNSOpaque16 flags;
26 DNSMessageHeader;
27 typedef struct __attribute__ ((__packed__))
29 DNSMessageHeader h;
32 DNSMessage;
33 struct DNSQuestion_struct
35 DNSQuestion *next;
36 long LastQTime;
37 mDNSOpaque16 TargetQID;
39 struct mDNS_struct
41 long timenow;
42 DNSQuestion *Questions;
44 extern long mDNSPlatformOneSecond;
45 typedef enum
47 kDNSFlag0_QR_Mask = 0x80, kDNSFlag0_QR_Query = 0x00, kDNSFlag0_QR_Response =
48 0x80, kDNSFlag0_OP_Mask = 0x78, kDNSFlag0_OP_StdQuery =
49 0x00, kDNSFlag0_OP_Iquery = 0x08, kDNSFlag0_OP_Status =
50 0x10, kDNSFlag0_OP_Unused3 = 0x18, kDNSFlag0_OP_Notify =
51 0x20, kDNSFlag0_OP_Update = 0x28, kDNSFlag0_QROP_Mask =
52 kDNSFlag0_QR_Mask | kDNSFlag0_OP_Mask, kDNSFlag0_AA = 0x04, kDNSFlag0_TC =
53 0x02, kDNSFlag0_RD = 0x01, kDNSFlag1_RA = 0x80, kDNSFlag1_Zero =
54 0x40, kDNSFlag1_AD = 0x20, kDNSFlag1_CD = 0x10, kDNSFlag1_RC_Mask =
55 0x0F, kDNSFlag1_RC_NoErr = 0x00, kDNSFlag1_RC_FormErr =
56 0x01, kDNSFlag1_RC_ServFail = 0x02, kDNSFlag1_RC_NXDomain =
57 0x03, kDNSFlag1_RC_NotImpl = 0x04, kDNSFlag1_RC_Refused =
58 0x05, kDNSFlag1_RC_YXDomain = 0x06, kDNSFlag1_RC_YXRRSet =
59 0x07, kDNSFlag1_RC_NXRRSet = 0x08, kDNSFlag1_RC_NotAuth =
60 0x09, kDNSFlag1_RC_NotZone = 0x0A
62 TSIG_ErrorCode;
63 void
64 uDNS_ReceiveMsg (mDNS * const m, DNSMessage * const msg,
65 const char * const end, const mDNSAddr * const srcaddr,
66 const mDNSIPPort srcport)
68 DNSQuestion *qptr;
69 char StdR = kDNSFlag0_QR_Response | kDNSFlag0_OP_StdQuery;
70 char QR_OP = (char) (msg->h.flags.b[0] & kDNSFlag0_QROP_Mask);
71 if (QR_OP == StdR)
73 if (uDNS_ReceiveTestQuestionResponse (m, msg, end, srcaddr, srcport))
74 return;
75 for (qptr = m->Questions; qptr; qptr = qptr->next)
76 if (msg->h.flags.b[0] & kDNSFlag0_TC
77 && ((qptr->TargetQID).NotAnInteger == (msg->h.id).NotAnInteger)
78 && m->timenow - qptr->LastQTime < (60 * mDNSPlatformOneSecond))