blob: b96c9ed8d932e708c7754e4a27861bb6384f82d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Test for oversized bitfield alignment in structs on IA-32
// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2" }
// Cygwin and mingw32 default to MASK_ALIGN_DOUBLE. Override to ensure
// 4-byte alignment.
// { dg-options "-mno-align-double" { target i?86-*-cygwin* i?86-*-mingw* } }
// { dg-require-effective-target ilp32 }
struct A
{
char a;
int b : 224; // { dg-warning "exceeds its type" "" }
char c;
} a, a4[4];
struct B
{
char d;
A e;
char f;
} b;
struct C
{
char g;
long long h : 64;
char i;
} c, c4[4];
struct D
{
char j;
C k;
char l;
} d;
struct E
{
char m;
long long n : 160; // { dg-warning "exceeds its type" "" }
char o;
} e, e4[4];
struct F
{
char p;
E q;
char r;
} f;
int main (void)
{
if (&a.c - &a.a != 32)
return 1;
if (sizeof (a) != 36)
return 2;
if (sizeof (a4) != 4 * 36)
return 3;
if (sizeof (b) != 2 * 4 + 36)
return 4;
if (__alignof__ (b.e) != 4)
return 5;
if (&c.i - &c.g != 12)
return 6;
if (sizeof (c) != 16)
return 7;
if (sizeof (c4) != 4 * 16)
return 8;
if (sizeof (d) != 2 * 4 + 16)
return 9;
if (__alignof__ (d.k) != 4)
return 10;
if (&e.o - &e.m != 24)
return 11;
if (sizeof (e) != 28)
return 12;
if (sizeof (e4) != 4 * 28)
return 13;
if (sizeof (f) != 2 * 4 + 28)
return 14;
if (__alignof__ (f.q) != 4)
return 15;
return 0;
}
|