PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / bf-ms-layout-3.c
blob668a036677d7dfe97625aad9d73dc83c58a215cd
1 /* Test for MS bitfield layout */
2 /* { dg-do run { target *-*-mingw* *-*-cygwin* i?86-*-* x86_64-*-* } } */
4 extern void abort();
6 struct s1_t {
7 char a;
8 char b __attribute__ ((aligned (16)));
9 } __attribute__ ((ms_struct));
10 struct s1_t s1;
12 struct s2_t {
13 char a;
14 char b;
15 } __attribute__ ((ms_struct));
16 struct s2_t s2;
18 struct s3_t {
19 __extension__ char a : 6;
20 char b __attribute__ ((aligned (16)));
21 } __attribute__ ((ms_struct));
22 struct s3_t s3;
24 struct s4_t {
25 __extension__ char a : 6;
26 char b __attribute__ ((aligned (2)));
27 } __attribute__ ((ms_struct));
28 struct s4_t s4;
30 struct s5_t {
31 __extension__ char a : 6;
32 char b __attribute__ ((aligned (1)));
33 } __attribute__ ((ms_struct));
34 struct s5_t s5;
36 __extension__
37 static __PTRDIFF_TYPE__ offs (const void *a, const void *b)
39 return (__PTRDIFF_TYPE__) ((const char*)a - (const char*)b);
42 int main()
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;