1 /** Tests that the static initialiser code works.
2 As the init code is now clever we have to be careful.
9 /*--------------------------------------------------
10 regression test for #1864582:
11 multiple definition of char cons w. --model-large
12 compile-time test only */
13 char *c = (char *) "Booting";
14 /*------------------------------------------------*/
16 static {type} smallDense[] = {
23 ASSERT(smallDense[0] == 1);
24 ASSERT(smallDense[1] == 2);
25 ASSERT(smallDense[2] == 3);
26 ASSERT(smallDense[3] == 4);
27 ASSERT(smallDense[4] == 5);
28 ASSERT(smallDense[5] == 6);
32 idata at 0xa0 /* leave space for the stack */
34 static {type} smallSparse[] = {
35 1, 1, 1, 1, 1, 1, 1, 1, 1
41 ASSERT(smallSparse[0] == 1);
42 ASSERT(smallSparse[1] == 1);
43 ASSERT(smallSparse[2] == 1);
44 ASSERT(smallSparse[3] == 1);
45 ASSERT(smallSparse[4] == 1);
46 ASSERT(smallSparse[5] == 1);
47 ASSERT(smallSparse[6] == 1);
48 ASSERT(smallSparse[7] == 1);
49 ASSERT(smallSparse[8] == 1);
55 static {type} smallSparseZero[] = {
56 0, 0, 0, 0, 0, 0, 0, 0, 0
59 static {type} smallSparseZeroTail[] = {
64 testSmallSparseZero(void)
66 ASSERT(smallSparseZero[0] == 0);
67 ASSERT(smallSparseZero[1] == 0);
68 ASSERT(smallSparseZero[2] == 0);
69 ASSERT(smallSparseZero[3] == 0);
70 ASSERT(smallSparseZero[4] == 0);
71 ASSERT(smallSparseZero[5] == 0);
72 ASSERT(smallSparseZero[6] == 0);
73 ASSERT(smallSparseZero[7] == 0);
74 ASSERT(smallSparseZero[8] == 0);
76 // Make the compiler happy
77 ASSERT(smallSparseZeroTail[0] == 1);
85 static {type} largeMixed[] = {
86 1, 2, 3, 4, 5, 6, 7, /* 0-6 */
87 1, 1, 1, 1, 1, 1, 1, 1,
88 1, 1, 1, 1, 1, 1, 1, 1,
89 1, 1, 1, 1, 1, 1, 1, 1,
90 1, 1, 1, 1, 1, 1, 1, 1,
91 1, 1, 1, 1, 1, 1, 1, 1,
92 1, 1, 1, 1, 1, 1, 1, 1,
93 1, 1, 1, 1, 1, 1, 1, 1,
94 1, 1, 1, 1, 1, 1, 1, 1,
95 1, 1, 1, 1, 1, 1, 1, 1,
96 1, 1, 1, 1, 1, 1, 1, 1,
97 1, 1, 1, 1, 1, 1, 1, 1,
98 1, 1, 1, 1, 1, 1, 1, 1,
99 1, 1, 1, 1, 1, 1, 1, 1,
100 1, 1, 1, 1, 1, 1, 1, 1, /* 8*12 = 96+7 = -102 */
101 1, 1, 1, 1, 1, 1, 1, 1,
102 1, 1, 1, 1, 1, 1, 1, 1,
103 1, 1, 1, 1, 1, 1, 1, 1,
104 3, 4, 5, 6, 3, 4, 5, 6, /* 8*17 = 136+7 */
105 3, 4, 5, 6, 3, 4, 5, 6,
106 3, 4, 5, 6, 3, 4, 5, 6,
107 3, 4, 5, 6, 3, 4, 5, 6,
108 3, 4, 5, 6, 3, 4, 5, 6,
109 3, 4, 5, 6, 3, 4, 5, 6,
110 3, 4, 5, 6, 3, 4, 5, 6,
111 3, 4, 5, 6, 3, 4, 5, 6,
112 3, 4, 5, 6, 3, 4, 5, 6,
113 3, 4, 5, 6, 3, 4, 5, 6,
114 3, 4, 5, 6, 3, 4, 5, 6,
115 3, 4, 5, 6, 3, 4, 5, 6,
116 3, 4, 5, 6, 3, 4, 5, 6,
117 3, 4, 5, 6, 3, 4, 5, 6,
118 3, 4, 5, 6, 3, 4, 5, 6,
119 3, 4, 5, 6, 3, 4, 5, 6,
120 3, 4, 5, 6, 3, 4, 5, 6
126 ASSERT(largeMixed[0] == 1);
127 ASSERT(largeMixed[1] == 2);
128 ASSERT(largeMixed[7] == 1);
129 ASSERT(largeMixed[102] == 1);
130 ASSERT(largeMixed[143] == 3);
131 ASSERT(largeMixed[143+8] == 3);
132 ASSERT(largeMixed[143+16] == 3);
133 ASSERT(largeMixed[143+1] == 4);
134 ASSERT(largeMixed[143+8+1] == 4);
135 ASSERT(largeMixed[143+16+1] == 4);