1 ! RUN: %S/test_errors.sh %s %t %flang_fc1 -fopenmp
4 ! 2.15.3.6 Reduction Clause
9 !$omp parallel private(k)
10 !ERROR: REDUCTION variable 'k' is PRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
11 !$omp do reduction(+:k)
19 !$omp parallel private(j),reduction(-:k)
20 !ERROR: REDUCTION variable 'k' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
21 !$omp do reduction(+:k)
28 !$omp parallel private(j),firstprivate(k)
29 !ERROR: REDUCTION variable 'k' is FIRSTPRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
30 !$omp do reduction(min:k)
38 !$omp parallel private(l,j),firstprivate(k)
39 !ERROR: REDUCTION variable 'k' is FIRSTPRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
40 !ERROR: REDUCTION variable 'j' is PRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
41 !$omp sections reduction(ior:k) reduction(-:j)
48 !$omp sections private(k)
49 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
50 !ERROR: REDUCTION variable 'k' is PRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
51 !$omp do reduction(+:k) reduction(max:j)
58 !$omp sections private(k)
61 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
62 !$omp do reduction(+:k) reduction(max:j)
71 !$omp parallel reduction(+:a)
72 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
73 !$omp sections reduction(-:a)
78 !$omp parallel reduction(-:a)
82 !$omp parallel reduction(+:a)
83 !ERROR: REDUCTION clause is not allowed on the WORKSHARE directive
84 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
85 !$omp workshare reduction(-:a)
90 !$omp parallel reduction(-:a)
94 !$omp parallel reduction(+:a)
95 !ERROR: REDUCTION clause is not allowed on the SINGLE directive
96 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
97 !$omp single reduction(-:a)
102 !$omp parallel reduction(-:a)
106 !$omp parallel reduction(+:a)
107 !ERROR: REDUCTION clause is not allowed on the SINGLE directive
108 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
109 !$omp single reduction(iand:a)
114 !$omp parallel reduction(iand:a)
117 !$omp parallel reduction(ieor:a)
118 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
119 !$omp sections reduction(-:a)
124 !$omp parallel reduction(ieor:a)
127 end program omp_reduction