blob: da94f54c1fb2cfaf105f03c1ce2a140bddd9e20f [file] [log] [blame]
Fariborz Jahanianed63e032011-05-10 19:00:50 +00001// RUN: %clang_cc1 -emit-llvm-only -triple i386-apple-darwin9 %s
2// rdar://8823265
3
4#pragma pack(1)
Fariborz Jahanian6ec50ad2011-05-11 16:58:31 +00005struct _one_ms {
6 short m:9; // size is 2
7 int q:27; // size is 6
8 short w:13; // size is 8
9 short e:3; // size is 8
10 char r:4; // size is 9
11 char t:7; // size is 10
12 short y:16; // size is 12
13 short u:1; // size is 14
14 char i:2; // size is 15
15 int a; // size is 19
16 char o:6; // size is 20
17 char s:2; // size is 20
18 short d:10; // size is 22
19 short f:4; // size is 22
20 char b; // size is 23
21 char g:1; // size is 24
22 short h:13; // size is 26
23 char j:8; // size is 27
24 char k:5; // size is 28
25 char c; // size is 29
26 int l:28; // size is 33
27 char z:7; // size is 34
28 int x:20; // size is 38
29} __attribute__((__ms_struct__));
30typedef struct _one_ms one_ms;
31
32static int a1[(sizeof(one_ms) == 38) - 1];
33
34#pragma pack(2)
Fariborz Jahanianed63e032011-05-10 19:00:50 +000035struct _two_ms {
Fariborz Jahanian225c5dd2011-05-11 17:07:02 +000036 short m:9;
37 int q:27;
38 short w:13;
39 short e:3;
40 char r:4;
41 char t:7;
42 short y:16;
43 short u:1;
44 char i:2;
45 int a;
46 char o:6;
47 char s:2;
48 short d:10;
49 short f:4;
50 char b;
51 char g:1;
52 short h:13;
53 char j:8;
54 char k:5;
55 char c;
56 int l:28;
57 char z:7;
58 int x:20;
Fariborz Jahanian6ec50ad2011-05-11 16:58:31 +000059} __attribute__((__ms_struct__));
60
Fariborz Jahanianed63e032011-05-10 19:00:50 +000061typedef struct _two_ms two_ms;
62
Fariborz Jahanian6ec50ad2011-05-11 16:58:31 +000063static int a2[(sizeof(two_ms) == 42) - 1];
64
65#pragma pack(4)
66struct _four_ms {
Fariborz Jahanian225c5dd2011-05-11 17:07:02 +000067 short m:9;
68 int q:27;
69 short w:13;
70 short e:3;
71 char r:4;
72 char t:7;
73 short y:16;
74 short u:1;
75 char i:2;
76 int a;
77 char o:6;
78 char s:2;
79 short d:10;
80 short f:4;
81 char b;
82 char g:1;
83 short h:13;
84 char j:8;
85 char k:5;
86 char c;
87 int l:28;
88 char z:7;
89 int x:20;
Fariborz Jahanian6ec50ad2011-05-11 16:58:31 +000090} __attribute__((__ms_struct__));
91typedef struct _four_ms four_ms;
92
93static int a4[(sizeof(four_ms) == 48) - 1];
94
95#pragma pack(8)
96struct _eight_ms {
Fariborz Jahanian225c5dd2011-05-11 17:07:02 +000097 short m:9;
98 int q:27;
99 short w:13;
100 short e:3;
101 char r:4;
102 char t:7;
103 short y:16;
104 short u:1;
105 char i:2;
106 int a;
107 char o:6;
108 char s:2;
109 short d:10;
110 short f:4;
111 char b;
112 char g:1;
113 short h:13;
114 char j:8;
115 char k:5;
116 char c;
117 int l:28;
118 char z:7;
119 int x:20;
Fariborz Jahanian6ec50ad2011-05-11 16:58:31 +0000120} __attribute__((__ms_struct__));
121
122typedef struct _eight_ms eight_ms;
123
124static int a8[(sizeof(eight_ms) == 48) - 1];
125