1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -fopenmp
3 ! 2.15.3.6 Reduction Clause
8 !$omp parallel private(k)
9 !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.
10 !$omp do reduction(+:k)
18 !$omp parallel private(j),reduction(-:k)
19 !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.
20 !$omp do reduction(+:k)
27 !$omp parallel private(j),firstprivate(k)
28 !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.
29 !$omp do reduction(min:k)
37 !$omp parallel private(l,j),firstprivate(k)
38 !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.
39 !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.
40 !$omp sections reduction(ior:k) reduction(-:j)
47 !$omp sections private(k)
48 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
49 !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.
50 !$omp do reduction(+:k) reduction(max:j)
57 !$omp sections private(k)
60 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
61 !$omp do reduction(+:k) reduction(max:j)
70 !$omp parallel reduction(+:a)
71 !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.
72 !$omp sections reduction(-:a)
77 !$omp parallel reduction(-:a)
81 !$omp parallel reduction(+:a)
82 !ERROR: REDUCTION clause is not allowed on the WORKSHARE directive
83 !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.
84 !$omp workshare reduction(-:a)
89 !$omp parallel reduction(-:a)
93 !$omp parallel reduction(+:a)
94 !ERROR: REDUCTION clause is not allowed on the SINGLE directive
95 !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.
96 !$omp single reduction(-:a)
101 !$omp parallel reduction(-:a)
105 !$omp parallel reduction(+:a)
106 !ERROR: REDUCTION clause is not allowed on the SINGLE directive
107 !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.
108 !$omp single reduction(iand:a)
113 !$omp parallel reduction(iand:a)
116 !$omp parallel reduction(ieor:a)
117 !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.
118 !$omp sections reduction(-:a)
123 !$omp parallel reduction(ieor:a)
126 end program omp_reduction