1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
3 ! Check OpenMP construct validity for the following directives:
4 ! 2.19.9 Ordered Construct
7 integer :: i
, j
, N
= 10
8 real :: arrayA(10), arrayB(10)
9 real, external :: foo
, bar
13 !$omp ordered depend(source)
15 !$omp ordered depend(sink: i - 1)
16 arrayB(i
) = bar(i
- 1)
24 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
25 !$omp ordered depend(source)
27 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
28 !$omp ordered depend(sink: i - 1)
29 arrayB(i
) = bar(i
- 1)
36 !$omp parallel do ordered(1)
38 !$omp ordered depend(source)
40 !$omp ordered depend(sink: i - 1)
41 arrayB(i
) = bar(i
- 1)
46 !$omp target parallel do ordered(1)
48 !$omp ordered depend(source)
50 !$omp ordered depend(sink: i - 1)
51 arrayB(i
) = bar(i
- 1)
53 !$omp end target parallel do
55 !ERROR: ORDERED clause is not allowed on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
56 !$omp target teams distribute parallel do ordered(1)
58 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
59 !$omp ordered depend(source)
61 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
62 !$omp ordered depend(sink: i - 1)
63 arrayB(i
) = bar(i
- 1)
65 !$omp end target teams distribute parallel do
69 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
70 !$omp ordered depend(source)
72 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
73 !$omp ordered depend(sink: i - 1)
74 arrayB(i
) = bar(i
- 1)
78 !$omp parallel do ordered
80 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
81 !$omp ordered depend(source)
83 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
84 !$omp ordered depend(sink: i - 1)
85 arrayB(i
) = bar(i
- 1)
89 !$omp target parallel do ordered
91 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
92 !$omp ordered depend(source)
94 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
95 !$omp ordered depend(sink: i - 1)
96 arrayB(i
) = bar(i
- 1)
98 !$omp end target parallel do
102 !ERROR: The number of variables in the SINK iteration vector does not match the parameter specified in ORDERED clause
103 !ERROR: The iteration vector element 'j' is not an induction variable within the ORDERED loop nest
104 !$omp ordered depend(sink: i - 1) depend(sink: i - 1, j)
105 arrayB(i
) = bar(i
- 1, j
)
112 !ERROR: The number of variables in the SINK iteration vector does not match the parameter specified in ORDERED clause
113 !$omp ordered depend(sink: i - 1) depend(sink: i - 1, j)
114 arrayB(i
) = foo(i
- 1) + bar(i
- 1, j
)
119 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
120 !$omp ordered depend(source)
122 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
123 !ERROR: The iteration vector element 'i' is not an induction variable within the ORDERED loop nest
124 !$omp ordered depend(sink: i - 1)