Fix type compatibility for types with flexible array member 2/2 [PR113688,PR114713...
[gcc.git] / libgomp / testsuite / libgomp.c / linear-1.c
blobf86fb33c5da657d382dbe0d7c69838c5f463ad7b
1 int a[256];
3 __attribute__((noinline, noclone)) int
4 f1 (int i)
6 #pragma omp parallel for linear (i: 4)
7 for (int j = 16; j < 64; j++)
9 a[i] = j;
10 i += 4;
12 return i;
15 __attribute__((noinline, noclone)) short int
16 f2 (short int i, char k)
18 #pragma omp parallel for linear (i: k + 1)
19 for (long j = 16; j < 64; j++)
21 a[i] = j;
22 i += 4;
24 return i;
27 __attribute__((noinline, noclone)) long long int
28 f3 (long long int i, long long int k)
30 #pragma omp parallel for linear (i: k)
31 for (short j = 16; j < 64; j++)
33 a[i] = j;
34 i += 4;
36 return i;
39 __attribute__((noinline, noclone)) int
40 f4 (int i)
42 #pragma omp parallel for linear (i: 4) schedule(static, 3)
43 for (int j = 16; j < 64; j++)
45 a[i] = j;
46 i += 4;
48 return i;
51 __attribute__((noinline, noclone)) short int
52 f5 (short int i, char k)
54 #pragma omp parallel for linear (i: k + 1) schedule(static, 5)
55 for (long j = 16; j < 64; j++)
57 a[i] = j;
58 i += 4;
60 return i;
63 __attribute__((noinline, noclone)) long long int
64 f6 (long long int i, long long int k)
66 #pragma omp parallel for linear (i: k) schedule(static, 7)
67 for (short j = 16; j < 64; j++)
69 a[i] = j;
70 i += 4;
72 return i;
75 __attribute__((noinline, noclone)) int
76 f7 (int i)
78 #pragma omp parallel for linear (i: 4) schedule(dynamic, 3)
79 for (int j = 16; j < 64; j++)
81 a[i] = j;
82 i += 4;
84 return i;
87 __attribute__((noinline, noclone)) short int
88 f8 (short int i, char k)
90 #pragma omp parallel for linear (i: k + 1) schedule(dynamic, 5)
91 for (long j = 16; j < 64; j++)
93 a[i] = j;
94 i += 4;
96 return i;
99 __attribute__((noinline, noclone)) long long int
100 f9 (long long int i, long long int k)
102 #pragma omp parallel for linear (i: k) schedule(dynamic, 7)
103 for (short j = 16; j < 64; j++)
105 a[i] = j;
106 i += 4;
108 return i;
111 __attribute__((noinline, noclone)) int
112 f10 (int i, long step)
114 #pragma omp parallel for linear (i: 4)
115 for (int j = 16; j < 112; j += step)
117 a[i] = j / 2 + 8;
118 i += 4;
120 return i;
123 __attribute__((noinline, noclone)) short int
124 f11 (short int i, char k, char step)
126 #pragma omp parallel for linear (i: k + 1)
127 for (long j = 16; j < 112; j += step)
129 a[i] = j / 2 + 8;
130 i += 4;
132 return i;
135 __attribute__((noinline, noclone)) long long int
136 f12 (long long int i, long long int k, int step)
138 #pragma omp parallel for linear (i: k)
139 for (short j = 16; j < 112; j += step)
141 a[i] = j / 2 + 8;
142 i += 4;
144 return i;
147 __attribute__((noinline, noclone)) int
148 f13 (int i, long long int step)
150 #pragma omp parallel for linear (i: 4) schedule(static, 3)
151 for (int j = 16; j < 112; j += step)
153 a[i] = j / 2 + 8;
154 i += 4;
156 return i;
159 __attribute__((noinline, noclone)) short int
160 f14 (short int i, char k, int step)
162 #pragma omp parallel for linear (i: k + 1) schedule(static, 5)
163 for (long j = 16; j < 112; j += step)
165 a[i] = j / 2 + 8;
166 i += 4;
168 return i;
171 __attribute__((noinline, noclone)) long long int
172 f15 (long long int i, long long int k, long int step)
174 #pragma omp parallel for linear (i: k) schedule(static, 7)
175 for (short j = 16; j < 112; j += step)
177 a[i] = j / 2 + 8;
178 i += 4;
180 return i;
183 __attribute__((noinline, noclone)) int
184 f16 (int i, long long int step)
186 #pragma omp parallel for linear (i: 4) schedule(dynamic, 3)
187 for (int j = 16; j < 112; j += step)
189 a[i] = j / 2 + 8;
190 i += 4;
192 return i;
195 __attribute__((noinline, noclone)) short int
196 f17 (short int i, char k, int step)
198 #pragma omp parallel for linear (i: k + 1) schedule(dynamic, 5)
199 for (long j = 16; j < 112; j += step)
201 a[i] = j / 2 + 8;
202 i += 4;
204 return i;
207 __attribute__((noinline, noclone)) long long int
208 f18 (long long int i, long long int k, long int step)
210 #pragma omp parallel for linear (i: k) schedule(dynamic, 7)
211 for (short j = 16; j < 112; j += step)
213 a[i] = j / 2 + 8;
214 i += 4;
216 return i;
220 main ()
222 #define TEST(x) \
223 if (x != 8 + 48 * 4) \
224 __builtin_abort (); \
225 for (int i = 0; i < 256; i++) \
226 if (a[i] != (((i & 3) == 0 && i >= 8 \
227 && i < 8 + 48 * 4) \
228 ? ((i - 8) / 4) + 16 : 0)) \
229 __builtin_abort (); \
230 __builtin_memset (a, 0, sizeof (a))
231 TEST (f1 (8));
232 TEST (f2 (8, 3));
233 TEST (f3 (8LL, 4LL));
234 TEST (f4 (8));
235 TEST (f5 (8, 3));
236 TEST (f6 (8LL, 4LL));
237 TEST (f7 (8));
238 TEST (f8 (8, 3));
239 TEST (f9 (8LL, 4LL));
240 TEST (f10 (8, 2));
241 TEST (f11 (8, 3, 2));
242 TEST (f12 (8LL, 4LL, 2));
243 TEST (f13 (8, 2));
244 TEST (f14 (8, 3, 2));
245 TEST (f15 (8LL, 4LL, 2));
246 TEST (f16 (8, 2));
247 TEST (f17 (8, 3, 2));
248 TEST (f18 (8LL, 4LL, 2));
249 return 0;