374
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
60
|
5 // copied from gcc-3.4.2/gcc/testsuite/gcc.c-torture/execute/align-2.c
|
|
6 module dstress.run.align_07;
|
|
7
|
|
8 /* Simple alignment checks;
|
|
9 looking for compiler/assembler alignment disagreements,
|
|
10 agreement between struct initialization and access. */
|
|
11
|
|
12 struct a_short { char c; short s; }
|
|
13 static a_short s_c_s = { 'a', 13 };
|
|
14
|
|
15 struct a_int { char c ; int i; }
|
|
16 static a_int s_c_i = { 'b', 14 };
|
|
17
|
|
18 struct b_int { short s; int i; }
|
|
19 b_int s_s_i = { 15, 16 };
|
|
20
|
|
21 struct a_float { char c; float f; }
|
|
22 a_float s_c_f = { 'c', 17.0 };
|
|
23
|
|
24 struct b_float { short s; float f; }
|
|
25 b_float s_s_f = { 18, 19.0 };
|
|
26
|
|
27 struct a_double { char c; double d; }
|
|
28 a_double s_c_d = { 'd', 20.0 };
|
|
29
|
|
30 struct b_double { short s; double d; }
|
|
31 b_double s_s_d = { 21, 22.0 };
|
|
32
|
|
33 struct c_double { int i; double d; }
|
|
34 c_double s_i_d = { 23, 24.0 };
|
|
35
|
|
36 struct d_double { float f; double d; }
|
|
37 d_double s_f_d = { 25.0, 26.0 };
|
|
38
|
|
39 struct a_real { char c; real ld; }
|
|
40 a_real s_c_ld = { 'e', 27.0 };
|
|
41
|
|
42 struct b_real { short s; real ld; }
|
|
43 b_real s_s_ld = { 28, 29.0 };
|
|
44
|
|
45 struct c_real { int i; real ld; }
|
|
46 c_real s_i_ld = { 30, 31.0 };
|
|
47
|
|
48 struct d_real { float f; real ld; }
|
|
49 d_real s_f_ld = { 32.0, 33.0 };
|
|
50
|
|
51 struct e_real { double d; real ld; }
|
|
52 e_real s_d_ld = { 34.0, 35.0 };
|
|
53
|
|
54 int main (){
|
1559
|
55 if('a' != s_c_s.c){ assert(0); }
|
|
56 if(13 != s_c_s.s){ assert(0); }
|
|
57 if('b' != s_c_i.c){ assert(0); }
|
|
58 if(14 != s_c_i.i){ assert(0); }
|
|
59 if(15 != s_s_i.s){ assert(0); }
|
|
60 if(16 != s_s_i.i){ assert(0); }
|
|
61 if('c' != s_c_f.c){ assert(0); }
|
|
62 if(17.0 != s_c_f.f){ assert(0); }
|
|
63 if(18 != s_s_f.s){ assert(0); }
|
|
64 if(19.0 != s_s_f.f){ assert(0); }
|
|
65 if('d' != s_c_d.c){ assert(0); }
|
|
66 if(20.0 != s_c_d.d){ assert(0); }
|
|
67 if(21 != s_s_d.s){ assert(0); }
|
|
68 if(22.0 != s_s_d.d){ assert(0); }
|
|
69 if(23 != s_i_d.i){ assert(0); }
|
|
70 if(24.0 != s_i_d.d){ assert(0); }
|
|
71 if(25.0 != s_f_d.f){ assert(0); }
|
|
72 if(26.0 != s_f_d.d){ assert(0); }
|
|
73 if('e' != s_c_ld.c){ assert(0); }
|
|
74 if(27.0 != s_c_ld.ld){ assert(0); }
|
|
75 if(28 != s_s_ld.s){ assert(0); }
|
|
76 if(29.0 != s_s_ld.ld){ assert(0); }
|
|
77 if(30 != s_i_ld.i){ assert(0); }
|
|
78 if(31.0 != s_i_ld.ld){ assert(0); }
|
|
79 if(32.0 != s_f_ld.f){ assert(0); }
|
|
80 if(33.0 != s_f_ld.ld){ assert(0); }
|
|
81 if(34.0 != s_d_ld.d){ assert(0); }
|
|
82 if(35.0 != s_d_ld.ld){ assert(0); }
|
60
|
83 return 0;
|
|
84 }
|