5 struct R { R () {}; ~R () {}; int r; };
6 struct T { T () {}; virtual ~T () {}; int t; };
8 struct A : public R, virtual public T { A () : b(c) {} int a; int &b; void m1 (); };
11 take (int &a, int &b, int &c, int &d)
13 asm volatile ("" : : "g" (&a), "g" (&b), "g" (&c), "g" (&d) : "memory");
19 #pragma omp parallel private (a, r, T::t, A::b)
21 int q = omp_get_thread_num ();
28 if (A::a != q || R::r != 2 * q || T::t != 3 * q || A::b != 4 * q)
35 #pragma omp parallel firstprivate (A::a, R::r, t, b)
37 int q = omp_get_thread_num ();
38 take (A::a, R::r, T::t, A::b);
39 if (a != 7 || r != 8 || t != 9 || b != 10)
47 if (a != 5 * q || r != 6 * q || t != 7 * q || b != 8 * q)
56 #pragma omp parallel for firstprivate (a, T::t, b, f) lastprivate (A::a, r, t, n)
57 for (int i = 0; i < omp_get_num_threads (); i++)
59 int q = omp_get_thread_num ();
62 if (A::a != -5 || A::b != -4 || T::t != -2)
65 else if (a != q || b != 2 * q || r != 3 * q || t != 4 * q)
75 if (a != n || r != 3 * n || T::t != 4 * n)
80 for (int i = 0; i < 5; i++)
81 #pragma omp task firstprivate (t, b, n) private (a, R::r)
83 if (t != 4 * n || b != 8)
90 if (a != 9 || r != 8 || t != 12 || b != 18)
97 #pragma omp parallel private (f)
101 #pragma omp taskloop firstprivate (r, T::t, b, f) lastprivate (a, t, b, n)
102 for (int i = 0; i < 30; i++)
104 int q = omp_get_thread_num ();
107 if (R::r != 3 || A::b != 2 || T::t != 4)
110 else if (a != 7 * q || b != 8 * q || r != 9 * q || t != 10 * q)
121 if (a != 7 * n || b != 8 * n || t != 10 * n)
127 #pragma omp parallel private (f)
131 #pragma omp taskloop firstprivate (r, T::t, b, A::a, f)
132 for (int i = 0; i < 30; i++)
134 int q = omp_get_thread_num ();
137 if (A::a != 1 || R::r != 3 || A::b != 2 || T::t != 4)
140 else if (a != 7 * q || b != 8 * q || r != 9 * q || t != 10 * q)
150 #pragma omp parallel private (f)
154 #pragma omp taskloop lastprivate (a, t, b, n) private (R::r)
155 for (int i = 0; i < 30; i++)
157 int q = omp_get_thread_num ();
158 if (f && (a != 7 * q || b != 8 * q || r != 9 * q || t != 10 * q))
169 if (a != 7 * n || b != 8 * n || t != 10 * n)
171 #pragma omp parallel private (a, T::t, A::b, r)
173 int q = omp_get_thread_num ();
179 #pragma omp single copyprivate (A::a, t, b, R::r)
181 if (a != n || b != 2 * n || r != 3 * n || t != 4 * n)
188 #pragma omp parallel for reduction (+: A::a, t, b, R::r)
189 for (int i = 0; i < 30; i++)
197 if (A::a != 435 || b != 2 * 435 || R::r != 3 * 435 || t != 4 * 435)