xref: /openbsd-src/gnu/usr.bin/gcc/gcc/testsuite/consistency.vlad/layout/biggest-field-align.c (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
1*c87b03e5Sespie #include <stdio.h>
2*c87b03e5Sespie #include <stddef.h>
3*c87b03e5Sespie 
4*c87b03e5Sespie static struct {char m;} s0;
5*c87b03e5Sespie static struct {short m;} s1;
6*c87b03e5Sespie static struct {int m;} s2;
7*c87b03e5Sespie static struct {long m;} s3;
8*c87b03e5Sespie static struct {long long m;} s4;
9*c87b03e5Sespie static struct {char * m;} s5;
10*c87b03e5Sespie static struct {float m;} s6;
11*c87b03e5Sespie static struct {double m;} s7;
12*c87b03e5Sespie static struct {long double m;} s8;
13*c87b03e5Sespie static struct {ptrdiff_t m;} s9;
14*c87b03e5Sespie static struct {size_t m;} s10;
15*c87b03e5Sespie static struct {wchar_t m;} s11;
16*c87b03e5Sespie static struct {struct {char m;}m;} s12;
17*c87b03e5Sespie static struct {struct {short m;}m;} s13;
18*c87b03e5Sespie static struct {struct {int m;}m;} s14;
19*c87b03e5Sespie static struct {struct {long m;}m;} s15;
20*c87b03e5Sespie static struct {struct {long long m;}m;} s16;
21*c87b03e5Sespie static struct {struct {char * m;}m;} s17;
22*c87b03e5Sespie static struct {struct {float m;}m;} s18;
23*c87b03e5Sespie static struct {struct {double m;}m;} s19;
24*c87b03e5Sespie static struct {struct {long double m;}m;} s20;
25*c87b03e5Sespie static struct {struct {ptrdiff_t m;}m;} s21;
26*c87b03e5Sespie static struct {struct {size_t m;}m;} s22;
27*c87b03e5Sespie static struct {struct {wchar_t m;}m;} s23;
28*c87b03e5Sespie static struct {char m [10];} s24;
29*c87b03e5Sespie static struct {short m [10];} s25;
30*c87b03e5Sespie static struct {int m [10];} s26;
31*c87b03e5Sespie static struct {long m [10];} s27;
32*c87b03e5Sespie static struct {long long m [10];} s28;
33*c87b03e5Sespie static struct {char * m [10];} s29;
34*c87b03e5Sespie static struct {float m [10];} s30;
35*c87b03e5Sespie static struct {double m [10];} s31;
36*c87b03e5Sespie static struct {long double m [10];} s32;
37*c87b03e5Sespie static struct {ptrdiff_t m [10];} s33;
38*c87b03e5Sespie static struct {size_t m [10];} s34;
39*c87b03e5Sespie static struct {wchar_t m [10];} s35;
40*c87b03e5Sespie static struct {int :0; char m;} s36;
41*c87b03e5Sespie static struct {int :0; short m;} s37;
42*c87b03e5Sespie static struct {int :0; int m;} s38;
43*c87b03e5Sespie static struct {int :0; long m;} s39;
44*c87b03e5Sespie static struct {int :0; long long m;} s40;
45*c87b03e5Sespie static struct {int :0; char * m;} s41;
46*c87b03e5Sespie static struct {int :0; float m;} s42;
47*c87b03e5Sespie static struct {int :0; double m;} s43;
48*c87b03e5Sespie static struct {int :0; long double m;} s44;
49*c87b03e5Sespie static struct {int :0; ptrdiff_t m;} s45;
50*c87b03e5Sespie static struct {int :0; size_t m;} s46;
51*c87b03e5Sespie static struct {int :0; wchar_t m;} s47;
main(void)52*c87b03e5Sespie int main (void) {
53*c87b03e5Sespie   int max_align = 0;
54*c87b03e5Sespie   printf ("+++Biggest field alignment:\n");
55*c87b03e5Sespie   if (max_align < __alignof__ (s0.m))
56*c87b03e5Sespie      max_align = __alignof__ (s0.m);
57*c87b03e5Sespie   if (max_align < __alignof__ (s1.m))
58*c87b03e5Sespie      max_align = __alignof__ (s1.m);
59*c87b03e5Sespie   if (max_align < __alignof__ (s2.m))
60*c87b03e5Sespie      max_align = __alignof__ (s2.m);
61*c87b03e5Sespie   if (max_align < __alignof__ (s3.m))
62*c87b03e5Sespie      max_align = __alignof__ (s3.m);
63*c87b03e5Sespie   if (max_align < __alignof__ (s4.m))
64*c87b03e5Sespie      max_align = __alignof__ (s4.m);
65*c87b03e5Sespie   if (max_align < __alignof__ (s5.m))
66*c87b03e5Sespie      max_align = __alignof__ (s5.m);
67*c87b03e5Sespie   if (max_align < __alignof__ (s6.m))
68*c87b03e5Sespie      max_align = __alignof__ (s6.m);
69*c87b03e5Sespie   if (max_align < __alignof__ (s7.m))
70*c87b03e5Sespie      max_align = __alignof__ (s7.m);
71*c87b03e5Sespie   if (max_align < __alignof__ (s8.m))
72*c87b03e5Sespie      max_align = __alignof__ (s8.m);
73*c87b03e5Sespie   if (max_align < __alignof__ (s9.m))
74*c87b03e5Sespie      max_align = __alignof__ (s9.m);
75*c87b03e5Sespie   if (max_align < __alignof__ (s10.m))
76*c87b03e5Sespie      max_align = __alignof__ (s10.m);
77*c87b03e5Sespie   if (max_align < __alignof__ (s11.m))
78*c87b03e5Sespie      max_align = __alignof__ (s11.m);
79*c87b03e5Sespie   if (max_align < __alignof__ (s12.m))
80*c87b03e5Sespie      max_align = __alignof__ (s12.m);
81*c87b03e5Sespie   if (max_align < __alignof__ (s13.m))
82*c87b03e5Sespie      max_align = __alignof__ (s13.m);
83*c87b03e5Sespie   if (max_align < __alignof__ (s14.m))
84*c87b03e5Sespie      max_align = __alignof__ (s14.m);
85*c87b03e5Sespie   if (max_align < __alignof__ (s15.m))
86*c87b03e5Sespie      max_align = __alignof__ (s15.m);
87*c87b03e5Sespie   if (max_align < __alignof__ (s16.m))
88*c87b03e5Sespie      max_align = __alignof__ (s16.m);
89*c87b03e5Sespie   if (max_align < __alignof__ (s17.m))
90*c87b03e5Sespie      max_align = __alignof__ (s17.m);
91*c87b03e5Sespie   if (max_align < __alignof__ (s18.m))
92*c87b03e5Sespie      max_align = __alignof__ (s18.m);
93*c87b03e5Sespie   if (max_align < __alignof__ (s19.m))
94*c87b03e5Sespie      max_align = __alignof__ (s19.m);
95*c87b03e5Sespie   if (max_align < __alignof__ (s20.m))
96*c87b03e5Sespie      max_align = __alignof__ (s20.m);
97*c87b03e5Sespie   if (max_align < __alignof__ (s21.m))
98*c87b03e5Sespie      max_align = __alignof__ (s21.m);
99*c87b03e5Sespie   if (max_align < __alignof__ (s22.m))
100*c87b03e5Sespie      max_align = __alignof__ (s22.m);
101*c87b03e5Sespie   if (max_align < __alignof__ (s23.m))
102*c87b03e5Sespie      max_align = __alignof__ (s23.m);
103*c87b03e5Sespie   if (max_align < __alignof__ (s24.m))
104*c87b03e5Sespie      max_align = __alignof__ (s24.m);
105*c87b03e5Sespie   if (max_align < __alignof__ (s25.m))
106*c87b03e5Sespie      max_align = __alignof__ (s25.m);
107*c87b03e5Sespie   if (max_align < __alignof__ (s26.m))
108*c87b03e5Sespie      max_align = __alignof__ (s26.m);
109*c87b03e5Sespie   if (max_align < __alignof__ (s27.m))
110*c87b03e5Sespie      max_align = __alignof__ (s27.m);
111*c87b03e5Sespie   if (max_align < __alignof__ (s28.m))
112*c87b03e5Sespie      max_align = __alignof__ (s28.m);
113*c87b03e5Sespie   if (max_align < __alignof__ (s29.m))
114*c87b03e5Sespie      max_align = __alignof__ (s29.m);
115*c87b03e5Sespie   if (max_align < __alignof__ (s30.m))
116*c87b03e5Sespie      max_align = __alignof__ (s30.m);
117*c87b03e5Sespie   if (max_align < __alignof__ (s31.m))
118*c87b03e5Sespie      max_align = __alignof__ (s31.m);
119*c87b03e5Sespie   if (max_align < __alignof__ (s32.m))
120*c87b03e5Sespie      max_align = __alignof__ (s32.m);
121*c87b03e5Sespie   if (max_align < __alignof__ (s33.m))
122*c87b03e5Sespie      max_align = __alignof__ (s33.m);
123*c87b03e5Sespie   if (max_align < __alignof__ (s34.m))
124*c87b03e5Sespie      max_align = __alignof__ (s34.m);
125*c87b03e5Sespie   if (max_align < __alignof__ (s35.m))
126*c87b03e5Sespie      max_align = __alignof__ (s35.m);
127*c87b03e5Sespie   if (max_align < __alignof__ (s36.m))
128*c87b03e5Sespie      max_align = __alignof__ (s36.m);
129*c87b03e5Sespie   if (max_align < __alignof__ (s37.m))
130*c87b03e5Sespie      max_align = __alignof__ (s37.m);
131*c87b03e5Sespie   if (max_align < __alignof__ (s38.m))
132*c87b03e5Sespie      max_align = __alignof__ (s38.m);
133*c87b03e5Sespie   if (max_align < __alignof__ (s39.m))
134*c87b03e5Sespie      max_align = __alignof__ (s39.m);
135*c87b03e5Sespie   if (max_align < __alignof__ (s40.m))
136*c87b03e5Sespie      max_align = __alignof__ (s40.m);
137*c87b03e5Sespie   if (max_align < __alignof__ (s41.m))
138*c87b03e5Sespie      max_align = __alignof__ (s41.m);
139*c87b03e5Sespie   if (max_align < __alignof__ (s42.m))
140*c87b03e5Sespie      max_align = __alignof__ (s42.m);
141*c87b03e5Sespie   if (max_align < __alignof__ (s43.m))
142*c87b03e5Sespie      max_align = __alignof__ (s43.m);
143*c87b03e5Sespie   if (max_align < __alignof__ (s44.m))
144*c87b03e5Sespie      max_align = __alignof__ (s44.m);
145*c87b03e5Sespie   if (max_align < __alignof__ (s45.m))
146*c87b03e5Sespie      max_align = __alignof__ (s45.m);
147*c87b03e5Sespie   if (max_align < __alignof__ (s46.m))
148*c87b03e5Sespie      max_align = __alignof__ (s46.m);
149*c87b03e5Sespie   if (max_align < __alignof__ (s47.m))
150*c87b03e5Sespie      max_align = __alignof__ (s47.m);
151*c87b03e5Sespie   printf ("max field align=%d\n", max_align);
152*c87b03e5Sespie   return 0;
153*c87b03e5Sespie }
154