1 // RUN: %clang_cc1 -triple armv7-unknown-unknown -target-abi apcs-gnu %s -verify
2 // RUN: %clang_cc1 -triple armv7-unknown-unknown -target-abi aapcs %s -verify
3 // expected-no-diagnostics
4 
5 #define check(name, cond) int _##name##_check[(cond) ? 1 : -1]
6 
7 struct s0 { char field0; double field1; };
8 #ifdef __ARM_EABI__
9 check(s0_size, sizeof(struct s0) == 16);
10 #else
11 check(s0_size, sizeof(struct s0) == 12);
12 #endif
13 
14 struct s1 { char field0; long double field1; };
15 #ifdef __ARM_EABI__
16 check(s1_size, sizeof(struct s1) == 16);
17 #else
18 check(s1_size, sizeof(struct s1) == 12);
19 #endif
20 
21 struct s2 {
22   short field0;
23   int field1 : 24;
24   char field2;
25 };
26 #ifdef __ARM_EABI__
27 check(s2_size, sizeof(struct s2) == 8);
28 check(s2_offset_0, __builtin_offsetof(struct s2, field0) == 0);
29 check(s2_offset_1, __builtin_offsetof(struct s2, field2) == 7);
30 #else
31 check(s2_size, sizeof(struct s2) == 6);
32 check(s2_offset_0, __builtin_offsetof(struct s2, field0) == 0);
33 check(s2_offset_1, __builtin_offsetof(struct s2, field2) == 5);
34 #endif
35 
36 struct s3 {
37   short field0;
38   int field1 : 24 __attribute__((aligned(4)));
39   char field2;
40 };
41 check(s3_size, sizeof(struct s3) == 8);
42 check(s3_offset_0, __builtin_offsetof(struct s3, field0) == 0);
43 check(s3_offset_1, __builtin_offsetof(struct s3, field2) == 7);
44 
45 struct s4 {
46   int field0 : 4;
47 };
48 #ifdef __ARM_EABI__
49 check(s4_size, sizeof(struct s4) == 4);
50 check(s4_align, __alignof(struct s4) == 4);
51 #else
52 check(s4_size, sizeof(struct s4) == 1);
53 check(s4_align, __alignof(struct s4) == 1);
54 #endif
55