LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / attr-ms_struct-1.c
blob1e6cca59946df91a821d117b7e62b84893cbb6eb
1 /* Test for MS structure sizes. */
2 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
3 /* { dg-require-effective-target ilp32 } */
4 /* { dg-options "-std=gnu99" } */
6 extern void abort ();
8 #define ATTR __attribute__((__ms_struct__))
10 #define size_struct_0 1
11 #define size_struct_1 4
12 #define size_struct_2 24
13 #define size_struct_3 8
14 #define size_struct_4 32
15 #define size_struct_5 12
16 #define size_struct_6 40
17 #define size_struct_7 8
18 #define size_struct_8 20
19 #define size_struct_9 32
21 struct _struct_0
23 char member_0;
24 } ATTR;
25 typedef struct _struct_0 struct_0;
27 struct _struct_1
29 char member_0;
30 short member_1:13;
31 } ATTR;
32 typedef struct _struct_1 struct_1;
34 struct _struct_2
36 double member_0;
37 unsigned char member_1:8;
38 long member_2:32;
39 unsigned char member_3:5;
40 short member_4:14;
41 short member_5:13;
42 unsigned char:0;
43 } ATTR;
44 typedef struct _struct_2 struct_2;
46 struct _struct_3
48 unsigned long member_0:26;
49 unsigned char member_1:2;
51 } ATTR;
52 typedef struct _struct_3 struct_3;
54 struct _struct_4
56 unsigned char member_0:7;
57 double member_1;
58 double member_2;
59 short member_3:5;
60 char member_4:2;
62 } ATTR;
63 typedef struct _struct_4 struct_4;
65 struct _struct_5
67 unsigned short member_0:12;
68 long member_1:1;
69 unsigned short member_2:6;
71 } ATTR;
72 typedef struct _struct_5 struct_5;
74 struct _struct_6
76 unsigned char member_0:7;
77 unsigned long member_1:25;
78 char member_2:1;
79 double member_3;
80 short member_4:9;
81 double member_5;
83 } ATTR;
84 typedef struct _struct_6 struct_6;
86 struct _struct_7
88 double member_0;
90 } ATTR;
91 typedef struct _struct_7 struct_7;
93 struct _struct_8
95 unsigned char member_0:7;
96 long member_1:11;
97 long member_2:5;
98 long:0;
99 char member_4:8;
100 unsigned short member_5:4;
101 unsigned char member_6:3;
102 long member_7:23;
104 } ATTR;
105 typedef struct _struct_8 struct_8;
107 struct _struct_9
109 double member_0;
110 unsigned long member_1:6;
111 long member_2:17;
112 double member_3;
113 unsigned long member_4:22;
115 } ATTR;
116 typedef struct _struct_9 struct_9;
118 struct_0 test_struct_0 = { 123 };
119 struct_1 test_struct_1 = { 82, 1081 };
120 struct_2 test_struct_2 = { 20.0, 31, 407760, 1, 14916, 6712 };
121 struct_3 test_struct_3 = { 64616999, 1 };
122 struct_4 test_struct_4 = { 61, 20.0, 20.0, 12, 0 };
123 struct_5 test_struct_5 = { 909, 1, 57 };
124 struct_6 test_struct_6 = { 12, 21355796, 0, 20.0, 467, 20.0 };
125 struct_7 test_struct_7 = { 20.0 };
126 struct_8 test_struct_8 = { 126, 1821, 22, 125, 6, 0, 2432638 };
127 struct_9 test_struct_9 = { 20.0, 3, 23957, 20.0, 1001631 };
131 main (void)
134 if (size_struct_0 != sizeof (struct_0))
135 abort ();
137 if (size_struct_1 != sizeof (struct_1))
138 abort ();
140 if (size_struct_2 != sizeof (struct_2))
141 abort ();
143 if (size_struct_3 != sizeof (struct_3))
144 abort ();
146 if (size_struct_4 != sizeof (struct_4))
147 abort ();
149 if (size_struct_5 != sizeof (struct_5))
150 abort ();
152 if (size_struct_6 != sizeof (struct_6))
153 abort ();
155 if (size_struct_7 != sizeof (struct_7))
156 abort ();
158 if (size_struct_8 != sizeof (struct_8))
159 abort ();
161 if (size_struct_9 != sizeof (struct_9))
162 abort ();
164 return 0;