1 // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-darwin9 %s
2 // rdar://8823265
3
4 extern void abort(void);
5 #define ATTR __attribute__((__ms_struct__))
6
7 struct
8 {
9 char foo;
10 long : 0;
11 char : 0;
12 int : 0;
13 char bar;
14 } ATTR t1 = {'a', 'b'};
15
16 struct
17 {
18 char bar0;
19 long : 0;
20 int : 0;
21 char bar1;
22 char bar2;
23 long : 0;
24 char bar3;
25 char bar4;
26 char : 0;
27 char bar5;
28 char bar6;
29 char : 0;
30 char bar7;
31 char bar8;
32 } ATTR t2 = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'};
33
34 struct {
35 int : 0;
36 int i1;
37 int : 0;
38 int i2;
39 int : 0;
40 int i3;
41 int : 0;
42 int i4;
43 } t3 = {1,2,3,4};
44
main()45 int main() {
46 if (sizeof(t1) != 2)
47 abort();
48 if (t1.foo != 'a')
49 abort();
50 if (t1.bar != 'b')
51 abort();
52 t1.foo = 'c';
53 t1.bar = 'd';
54 if (t1.foo != 'c')
55 abort();
56 if (t1.bar != 'd')
57 abort();
58 if (sizeof(t2) != 9)
59 abort();
60 if (t2.bar0 != 'a' || t2.bar8 != 'i')
61 abort();
62 if (sizeof(t3) != 16)
63 abort();
64 if (t3.i1 != 1 || t3.i4 != 4)
65 abort();
66 return 0;
67 }
68
69