Fix type compatibility for types with flexible array member 2/2 [PR113688,PR114713...
[gcc.git] / libgomp / testsuite / libgomp.c / loop-19.c
blob732ebb04153d93556f45020351a2f52681c062f1
1 /* { dg-do run } */
3 extern void abort (void);
5 int x, i, j;
6 volatile int a, b, c, d, e, f, g, h;
7 int k[16][67];
9 int
10 main ()
12 int niters;
13 for (i = 0; i < 16; i++)
14 for (j = i * 2 + 1; j < 4 * i + 3; j++)
15 k[i][j] = 1;
16 a = 0; b = 16; c = 1; d = 2; e = 1; f = 4; g = 3; h = 1;
17 niters = 0; i = -100; j = -100; x = -100;
18 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
19 for (i = 0; i < 16; i++)
20 for (j = i * 2 + 1; j < 4 * i + 3; j++)
22 if (i < 0 || i >= 16 || j < 2 * i + 1 || j >= 3 + i * 4 || k[i][j] != 1)
23 abort ();
24 k[i][j]++;
25 x = i * 1024 + (j & 1023);
26 niters++;
28 if (i != 16 || j != 63 || x != 15422 || niters != 272)
29 abort ();
30 niters = 0; i = -100; j = -100; x = -100;
31 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
32 for (i = a; i < b; i += c)
33 for (j = d * i + e; j < g + i * f; j += h)
35 if (i < 0 || i >= 16 || j < 2 * i + 1 || j >= 3 + i * 4 || k[i][j] != 2)
36 abort ();
37 k[i][j]++;
38 x = i * 1024 + (j & 1023);
39 niters++;
41 if (i != 16 || j != 63 || x != 15422 || niters != 272)
42 abort ();
43 for (i = 0; i < 16; i++)
44 for (j = i * 2 + 1; j < 4 * i + 3; j++)
45 if (k[i][j] == 3)
46 k[i][j] = 0;
47 else
48 abort ();
49 for (i = 0; i < 16; i++)
50 for (j = i * 2 + 1; j < 2 * i + 7; j++)
51 k[i][j] = 1;
52 a = 0; b = 16; c = 1; d = 2; e = 1; f = 2; g = 7; h = 1;
53 niters = 0; i = -100; j = -100; x = -100;
54 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
55 for (i = 0; i < 16; i++)
56 for (j = i * 2 + 1; j < 2 * i + 7; j++)
58 if (i < 0 || i >= 16 || j < 2 * i + 1 || j >= 7 + i * 2 || k[i][j] != 1)
59 abort ();
60 k[i][j]++;
61 x = i * 1024 + (j & 1023);
62 niters++;
64 if (i != 16 || j != 37 || x != 15396 || niters != 96)
65 abort ();
66 niters = 0; i = -100; j = -100; x = -100;
67 #pragma omp parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters)
68 for (i = a; i < b; i += c)
69 for (j = d * i + e; j < g + i * f; j += h)
71 if (i < 0 || i >= 16 || j < 2 * i + 1 || j >= 7 + i * 2 || k[i][j] != 2)
72 abort ();
73 k[i][j]++;
74 x = i * 1024 + (j & 1023);
75 niters++;
77 if (i != 16 || j != 37 || x != 15396 || niters != 96)
78 abort ();
79 for (i = 0; i < 16; i++)
80 for (j = i * 2 + 1; j < 2 * i + 7; j++)
81 if (k[i][j] == 3)
82 k[i][j] = 0;
83 else
84 abort ();
85 return 0;