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