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)
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