Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / ordered01.f90
blob9433120fab10f6d6fe85eb81439919e5c42e3232
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2 ! OpenMP Version 5.1
3 ! Check OpenMP construct validity for the following directives:
4 ! 2.19.9 Ordered Construct
6 program main
7 integer :: i, N = 10
8 real :: a, arrayA(10), arrayB(10), arrayC(10)
9 real, external :: foo, bar, baz
11 !$omp do ordered
12 do i = 1, N
13 !ERROR: At most one THREADS clause can appear on the ORDERED directive
14 !$omp ordered threads threads
15 arrayA(i) = i
16 !$omp end ordered
17 end do
18 !$omp end do
20 !$omp simd
21 do i = 1, N
22 !ERROR: At most one SIMD clause can appear on the ORDERED directive
23 !$omp ordered simd simd
24 arrayA(i) = i
25 !$omp end ordered
26 end do
27 !$omp end simd
29 !$omp do simd ordered
30 do i = 1, N
31 !ERROR: At most one SIMD clause can appear on the ORDERED directive
32 !$omp ordered simd simd
33 arrayA(i) = i
34 !$omp end ordered
35 end do
36 !$omp end do simd
38 !$omp do ordered(1)
39 do i = 2, N
40 !ERROR: Only DEPEND(SOURCE) or DEPEND(SINK: vec) are allowed when ORDERED construct is a standalone construct with no ORDERED region
41 !ERROR: At most one DEPEND(SOURCE) clause can appear on the ORDERED directive
42 !$omp ordered depend(source) depend(inout: arrayA) depend(source)
43 arrayA(i) = foo(i)
44 !ERROR: DEPEND(SOURCE) is not allowed when DEPEND(SINK: vec) is present on ORDERED directive
45 !ERROR: DEPEND(SOURCE) is not allowed when DEPEND(SINK: vec) is present on ORDERED directive
46 !ERROR: At most one DEPEND(SOURCE) clause can appear on the ORDERED directive
47 !$omp ordered depend(sink: i - 1) depend(source) depend(source)
48 arrayB(i) = bar(arrayA(i), arrayB(i-1))
49 !ERROR: Only DEPEND(SOURCE) or DEPEND(SINK: vec) are allowed when ORDERED construct is a standalone construct with no ORDERED region
50 !ERROR: Only DEPEND(SOURCE) or DEPEND(SINK: vec) are allowed when ORDERED construct is a standalone construct with no ORDERED region
51 !$omp ordered depend(out: arrayC) depend(in: arrayB)
52 arrayC(i) = baz(arrayB(i-1))
53 end do
54 !$omp end do
56 !$omp do ordered(1)
57 do i = 2, N
58 !ERROR: DEPEND(*) clauses are not allowed when ORDERED construct is a block construct with an ORDERED region
59 !$omp ordered depend(source)
60 arrayA(i) = foo(i)
61 !$omp end ordered
62 !ERROR: DEPEND(*) clauses are not allowed when ORDERED construct is a block construct with an ORDERED region
63 !$omp ordered depend(sink: i - 1)
64 arrayB(i) = bar(arrayA(i), arrayB(i-1))
65 !$omp end ordered
66 end do
67 !$omp end do
69 contains
70 subroutine work1()
71 !ERROR: THREADS, SIMD clauses are not allowed when ORDERED construct is a standalone construct with no ORDERED region
72 !$omp ordered simd
73 end subroutine work1
75 subroutine work2()
76 !ERROR: THREADS, SIMD clauses are not allowed when ORDERED construct is a standalone construct with no ORDERED region
77 !$omp ordered threads
78 end subroutine work2
80 end program main