1 typedef __SIZE_TYPE__ size_t;
2 extern void abort (void);
3
4 void
bar(int * a,int * b,int * c,int (* d)[2],int (* e)[4],size_t n,int f[1][n],int g[1][n * 2])5 bar (int *a, int *b, int *c, int (*d)[2], int (*e)[4], size_t n, int f[1][n], int g[1][n * 2])
6 {
7 #pragma omp task in_reduction (*: a[:n], b[3:n], c[n:n], d[0][:n], e[0][1:n], f[0][:], g[0][1:n])
8 {
9 a[0] *= 12;
10 a[1] *= 13;
11 b[3] *= 14;
12 b[4] *= 15;
13 c[n] *= 16;
14 c[n + 1] *= 17;
15 d[0][0] *= 18;
16 d[0][1] *= 19;
17 e[0][1] *= 20;
18 e[0][2] *= 21;
19 f[0][0] *= 22;
20 f[0][1] *= 23;
21 g[0][1] *= 24;
22 g[0][2] *= 25;
23 }
24 }
25
26 void
baz(size_t n,void * x,void * y,int f[1][n],int g[1][n * 2])27 baz (size_t n, void *x, void *y, int f[1][n], int g[1][n * 2])
28 {
29 int a[n], b[n + 3], c[2 * n];
30 int (*d)[n] = (int (*)[n]) x;
31 int (*e)[n * 2] = (int (*)[n * 2]) y;
32 int i;
33 for (i = 0; i < n; i++)
34 {
35 a[i] = 1;
36 b[i + 3] = 1;
37 c[i + n] = 1;
38 d[0][i] = 1;
39 e[0][i + 1] = 1;
40 f[0][i] = 1;
41 g[0][i + 1] = 1;
42 }
43 #pragma omp parallel num_threads(2) firstprivate (n) \
44 reduction (task, *: a, b[3:n], c[n:n], d[0][:n], e[0][1:n], f[0][:], g[0][1:n])
45 {
46 #pragma omp master
47 bar (a, b, c, (int (*)[2]) d, (int (*)[4]) e, n, f, g);
48 #pragma omp master
49 #pragma omp task in_reduction (*: a, b[3:n], c[n:n], d[0][:n], e[0][1:n], f[0][:], g[0][1:n])
50 {
51 a[0] *= 2;
52 a[1] *= 3;
53 b[3] *= 4;
54 b[4] *= 5;
55 c[n] *= 6;
56 c[n + 1] *= 7;
57 d[0][0] *= 8;
58 d[0][1] *= 9;
59 e[0][1] *= 10;
60 e[0][2] *= 11;
61 f[0][0] *= 12;
62 f[0][1] *= 13;
63 g[0][1] *= 14;
64 g[0][2] *= 15;
65 }
66 n = 0;
67 }
68 if (a[0] != 24 || a[1] != 39 || b[3] != 56 || b[4] != 75)
69 abort ();
70 if (c[2] != 96 || c[3] != 119 || d[0][0] != 144 || d[0][1] != 171)
71 abort ();
72 if (e[0][1] != 200 || e[0][2] != 231 || f[0][0] != 264 || f[0][1] != 299)
73 abort ();
74 if (g[0][1] != 336 || g[0][2] != 375)
75 abort ();
76 }
77
78 int
main()79 main ()
80 {
81 int d[1][2], e[1][4], f[1][2], g[1][4];
82 volatile int two;
83 two = 2;
84 baz (two, (void *) d, (void *) e, f, g);
85 return 0;
86 }
87