]>
Commit | Line | Data |
---|---|---|
9954e17f | 1 | /* Test for MS bitfield layout */ |
ee2499b4 | 2 | /* { dg-do run { target *-*-mingw* *-*-cygwin* i?86-*-* x86_64-*-* } } */ |
9954e17f KT |
3 | |
4 | extern void abort(); | |
5 | ||
6 | struct s1_t { | |
7 | char a; | |
8 | char b __attribute__ ((aligned (16))); | |
9 | } __attribute__ ((ms_struct)); | |
10 | struct s1_t s1; | |
11 | ||
12 | struct s2_t { | |
13 | char a; | |
14 | char b; | |
15 | } __attribute__ ((ms_struct)); | |
16 | struct s2_t s2; | |
17 | ||
18 | struct s3_t { | |
333f1d87 | 19 | __extension__ char a : 6; |
9954e17f KT |
20 | char b __attribute__ ((aligned (16))); |
21 | } __attribute__ ((ms_struct)); | |
22 | struct s3_t s3; | |
23 | ||
24 | struct s4_t { | |
333f1d87 | 25 | __extension__ char a : 6; |
9954e17f KT |
26 | char b __attribute__ ((aligned (2))); |
27 | } __attribute__ ((ms_struct)); | |
28 | struct s4_t s4; | |
29 | ||
30 | struct s5_t { | |
333f1d87 | 31 | __extension__ char a : 6; |
9954e17f KT |
32 | char b __attribute__ ((aligned (1))); |
33 | } __attribute__ ((ms_struct)); | |
34 | struct s5_t s5; | |
35 | ||
333f1d87 KT |
36 | __extension__ |
37 | static __PTRDIFF_TYPE__ offs (const void *a, const void *b) | |
9954e17f KT |
38 | { |
39 | return (__PTRDIFF_TYPE__) ((const char*)a - (const char*)b); | |
40 | } | |
41 | ||
42 | int main() | |
43 | { | |
44 | if (offs (&s1.b, &s1) != 16 | |
45 | || offs (&s2.b, &s2) != 1 | |
46 | || offs (&s3.b, &s3) != 16 | |
47 | || offs (&s4.b, &s4) != 2 | |
48 | || offs (&s5.b, &s5) != 1) | |
49 | abort (); | |
50 | return 0; | |
51 | } | |
52 |