1 /* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
2
3 /* Disable this test for 16-bit targets. */
4
5 #include <limits.h>
6
7 #if !(defined __GNUC__) || (INT_MAX > 32767)
8
9 #include "compat-common.h"
10 #include "struct-align-2.h"
11
12 #define SETUP(NAME,V1,V2,V3) \
13 struct outer_##NAME { \
14 int i; \
15 struct epoll_event_##NAME ee; \
16 }; \
17 \
18 unsigned int v1_##NAME = V1; \
19 unsigned int v2_##NAME = V2; \
20 unsigned long long v3_##NAME = V3; \
21 \
22 struct outer_##NAME s_##NAME[2] = \
23 { {V1, { V2, V3 } }, { V1, { V2, V3 } } }; \
24 \
25 extern void test_##NAME (void); \
26 extern void checkp_##NAME (struct outer_##NAME *); \
27 extern void checkg_##NAME (void); \
28 \
29 void \
30 pass_##NAME (struct outer_##NAME s) \
31 { \
32 checkp_##NAME (&s); \
33 } \
34 \
35 struct outer_##NAME \
36 return_##NAME (void) \
37 { \
38 return s_##NAME[0]; \
39 }
40
41 #define CHECK(NAME) \
42 test_##NAME()
43
44 SETUP (orig,101, 102, 0x0101010101010101ULL)
45 #ifndef SKIP_ATTRIBUTE
46 SETUP (structmax, 103, 104, 0x1212121212121212ULL)
47 SETUP (struct4, 105, 106, 0x2323232323232323ULL)
48 SETUP (struct8, 107, 108, 0x3434343434343434ULL)
49 SETUP (data4, 109, 110, 0x4545454545454545ULL)
50 SETUP (data8, 111, 112, 0x5656565656565656ULL)
51 SETUP (p, 113, 114, 0x6767676767676767ULL)
52 SETUP (pstruct4, 115, 116, 0x7878787878787878ULL)
53 SETUP (pstruct8, 117, 118, 0x8989898989898989ULL)
54 SETUP (pdata4, 119, 120, 0x9A9A9A9A9A9A9A9AULL)
55 SETUP (pdata8, 121, 122, 0xABABABABABABABABULL)
56 #endif
57
58 void
struct_align_2_x(void)59 struct_align_2_x (void)
60 {
61 DEBUG_INIT
62
63 CHECK (orig);
64 #ifndef SKIP_ATTRIBUTE
65 CHECK (structmax);
66 CHECK (struct4);
67 CHECK (struct8);
68 CHECK (data4);
69 CHECK (data8);
70 CHECK (p);
71 CHECK (pstruct4);
72 CHECK (pstruct8);
73 CHECK (pdata4);
74 CHECK (pdata8);
75 #endif
76
77 DEBUG_FINI
78
79 if (fails != 0)
80 abort ();
81 }
82
83 #else
84
struct_align_2_x(void)85 void struct_align_2_x (void) {}
86
87 #endif /* INT_MAX */
88