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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
#include "compat-common.h"
#include "struct-align-1.h"
#define SETUP(NAME,V1,V2,V3) \
char v1_##NAME = V1; \
double v2_##NAME = V2; \
int v3_##NAME = V3; \
\
struct B1_##NAME b1_##NAME = { V1, V2 }; \
struct B2_##NAME b2_##NAME = { V1, { V2 } }; \
struct B3_##NAME b3_##NAME = { V1, { V2, V3 } }; \
\
struct B1_##NAME ab1_##NAME[2] = \
{ { V1, V2 }, { V1, V2 } }; \
struct B2_##NAME ab2_##NAME[2] = \
{ { V1, { V2 } }, { V1, { V2 } } }; \
struct B3_##NAME ab3_##NAME[2] = \
{ { V1, { V2, V3 } }, { V1, { V2, V3 } } }; \
\
extern void test_##NAME (void); \
extern void checkp1_##NAME (struct B1_##NAME *); \
extern void checkp2_##NAME (struct B2_##NAME *); \
extern void checkp3_##NAME (struct B3_##NAME *); \
extern void checkg1_##NAME (void); \
extern void checkg2_##NAME (void); \
extern void checkg3_##NAME (void); \
\
void \
pass1_##NAME (struct B1_##NAME s) \
{ \
checkp1_##NAME (&s); \
} \
\
void \
pass2_##NAME (struct B2_##NAME s) \
{ \
checkp2_##NAME (&s); \
} \
\
void \
pass3_##NAME (struct B3_##NAME s) \
{ \
checkp3_##NAME (&s); \
} \
\
struct B1_##NAME \
return1_##NAME (void) \
{ \
return ab1_##NAME[0]; \
} \
\
struct B2_##NAME \
return2_##NAME (void) \
{ \
return ab2_##NAME[0]; \
} \
\
struct B3_##NAME \
return3_##NAME (void) \
{ \
return ab3_##NAME[0]; \
}
#define CHECK(NAME) test_##NAME()
#if __INT_MAX__ > 32767
SETUP (orig, 49, 1.0, 111111)
#else
SETUP (orig, 49, 1.0, 1111)
#endif
#ifndef SKIP_ATTRIBUTE
#if __INT_MAX__ > 32767
SETUP (p_all, 50, 2.0, 222222)
SETUP (p_inner, 51, 3.0, 333333)
SETUP (p_outer, 52, 4.0, 444444)
SETUP (a_max, 53, 5.0, 555555)
SETUP (m_outer_p_inner, 54, 6.0, 666666)
SETUP (m_inner_p_outer, 55, 7.0, 777777)
#else
SETUP (p_all, 50, 2.0, 2222)
SETUP (p_inner, 51, 3.0, 3333)
SETUP (p_outer, 52, 4.0, 4444)
SETUP (a_max, 53, 5.0, 5555)
SETUP (m_outer_p_inner, 54, 6.0, 6666)
SETUP (m_inner_p_outer, 55, 7.0, 7777)
#endif
#endif
void
struct_align_1_x (void)
{
DEBUG_INIT
CHECK (orig);
#ifndef SKIP_ATTRIBUTE
CHECK (p_all);
CHECK (p_inner);
CHECK (p_outer);
CHECK (a_max);
CHECK (m_outer_p_inner);
CHECK (m_inner_p_outer);
#endif
DEBUG_FINI
if (fails != 0)
abort ();
}
|