]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/bf-ms-layout-3.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / bf-ms-layout-3.c
CommitLineData
9954e17f 1/* Test for MS bitfield layout */
ee2499b4 2/* { dg-do run { target *-*-mingw* *-*-cygwin* i?86-*-* x86_64-*-* } } */
9954e17f
KT
3
4extern void abort();
5
6struct s1_t {
7 char a;
8 char b __attribute__ ((aligned (16)));
9} __attribute__ ((ms_struct));
10struct s1_t s1;
11
12struct s2_t {
13 char a;
14 char b;
15} __attribute__ ((ms_struct));
16struct s2_t s2;
17
18struct s3_t {
333f1d87 19 __extension__ char a : 6;
9954e17f
KT
20 char b __attribute__ ((aligned (16)));
21} __attribute__ ((ms_struct));
22struct s3_t s3;
23
24struct s4_t {
333f1d87 25 __extension__ char a : 6;
9954e17f
KT
26 char b __attribute__ ((aligned (2)));
27} __attribute__ ((ms_struct));
28struct s4_t s4;
29
30struct s5_t {
333f1d87 31 __extension__ char a : 6;
9954e17f
KT
32 char b __attribute__ ((aligned (1)));
33} __attribute__ ((ms_struct));
34struct s5_t s5;
35
333f1d87
KT
36__extension__
37static __PTRDIFF_TYPE__ offs (const void *a, const void *b)
9954e17f
KT
38{
39 return (__PTRDIFF_TYPE__) ((const char*)a - (const char*)b);
40}
41
42int 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