1 // RUN: %clang_cc1 -emit-llvm-only  -triple x86_64-apple-darwin9 %s
2 // rdar://8823265
3 
4 #define ATTR __attribute__((__ms_struct__))
5 
6 #define size_struct_0 1
7 #define size_struct_1 4
8 #define size_struct_2 24
9 #define size_struct_3 8
10 #define size_struct_4 32
11 #define size_struct_5 12
12 #define size_struct_6 40
13 #define size_struct_7 8
14 #define size_struct_8 20
15 #define size_struct_9 32
16 
17 struct _struct_0
18 {
19   char member_0;
20 } ATTR;
21 typedef struct _struct_0 struct_0;
22 
23 struct _struct_1
24 {
25   char member_0;
26   short member_1:13;
27 } ATTR;
28 typedef struct _struct_1 struct_1;
29 
30 struct _struct_2
31 {
32   double member_0;
33   unsigned char member_1:8;
34   int member_2:32;
35   unsigned char member_3:5;
36   short member_4:14;
37   short member_5:13;
38   unsigned char:0;
39 } ATTR;
40 typedef struct _struct_2 struct_2;
41 
42 struct _struct_3
43 {
44   unsigned int member_0:26;
45   unsigned char member_1:2;
46 
47 } ATTR;
48 typedef struct _struct_3 struct_3;
49 
50 struct _struct_4
51 {
52   unsigned char member_0:7;
53   double member_1;
54   double member_2;
55   short member_3:5;
56   char member_4:2;
57 
58 } ATTR;
59 typedef struct _struct_4 struct_4;
60 
61 struct _struct_5
62 {
63   unsigned short member_0:12;
64   int member_1:1;
65   unsigned short member_2:6;
66 
67 } ATTR;
68 typedef struct _struct_5 struct_5;
69 
70 struct _struct_6
71 {
72   unsigned char member_0:7;
73   unsigned int member_1:25;
74   char member_2:1;
75   double member_3;
76   short member_4:9;
77   double member_5;
78 
79 } ATTR;
80 typedef struct _struct_6 struct_6;
81 
82 struct _struct_7
83 {
84   double member_0;
85 
86 } ATTR;
87 typedef struct _struct_7 struct_7;
88 
89 struct _struct_8
90 {
91   unsigned char member_0:7;
92   int member_1:11;
93   int member_2:5;
94   int:0;
95   char member_4:8;
96   unsigned short member_5:4;
97   unsigned char member_6:3;
98   int member_7:23;
99 
100 } ATTR;
101 typedef struct _struct_8 struct_8;
102 
103 struct _struct_9
104 {
105   double member_0;
106   unsigned int member_1:6;
107   int member_2:17;
108   double member_3;
109   unsigned int member_4:22;
110 
111 } ATTR;
112 typedef struct _struct_9 struct_9;
113 
114 struct_0 test_struct_0 = { 123 };
115 struct_1 test_struct_1 = { 82, 1081 };
116 struct_2 test_struct_2 = { 20.0, 31, 407760, 1, 14916, 6712 };
117 struct_3 test_struct_3 = { 64616999, 1 };
118 struct_4 test_struct_4 = { 61, 20.0, 20.0, 12, 0 };
119 struct_5 test_struct_5 = { 909, 1, 57 };
120 struct_6 test_struct_6 = { 12, 21355796, 0, 20.0, 467, 20.0 };
121 struct_7 test_struct_7 = { 20.0 };
122 struct_8 test_struct_8 = { 126, 1821, 22, 125, 6, 0, 2432638 };
123 struct_9 test_struct_9 = { 20.0, 3, 23957, 20.0, 1001631 };
124 
125 
126 static int a0[(sizeof (struct_0) == size_struct_0) -1];
127 static int a1[(sizeof (struct_1) == size_struct_1) -1];
128 static int a2[(sizeof (struct_2) == size_struct_2) -1];
129 static int a3[(sizeof (struct_3) == size_struct_3) -1];
130 static int a4[(sizeof (struct_4) == size_struct_4) -1];
131 static int a5[(sizeof (struct_5) == size_struct_5) -1];
132 static int a6[(sizeof (struct_6) == size_struct_6) -1];
133 static int a7[(sizeof (struct_7) == size_struct_7) -1];
134 static int a8[(sizeof (struct_8) == size_struct_8) -1];
135 static int a9[(sizeof (struct_9) == size_struct_9) -1];
136