xref: /llvm-project/flang/test/Semantics/OpenMP/do-ordered.f90 (revision 502bea25bdc07d1811b8bfea1c2e6bfa8617f72f)
1!RUN: %python %S/../test_errors.py %s %flang -fopenmp
2! OpenMP Version 4.5
3! 2.7.1 Ordered Clause
4
5program omp_doOrdered
6  integer:: i,j
7  !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
8  !$omp do ordered(3)
9  do i = 1,10
10    do j = 1, 10
11      print *, "hello"
12    end do
13  end do
14  !$omp end do
15
16  do i = 1,10
17    do j = 1, 10
18      !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
19      !$omp do ordered(2)
20      do k = 1, 10
21        print *, "hello"
22      end do
23      !$omp end do
24    end do
25  end do
26
27  !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
28  !$omp do ordered(2)
29  do i = 1,10
30    !ERROR: An ORDERED directive without the DEPEND clause must be closely nested in a worksharing-loop (or worksharing-loop SIMD) region with ORDERED clause without the parameter
31    !$omp ordered
32    do j = 1, 10
33       print *, "hello"
34    end do
35    !$omp end ordered
36  end do
37  !$omp end do
38
39  !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
40  !$omp do collapse(1) ordered(3)
41  do i = 1,10
42    do j = 1, 10
43       print *, "hello"
44    end do
45  end do
46  !$omp end do
47
48  !$omp parallel num_threads(4)
49  !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
50  !$omp do ordered(2) collapse(1)
51  do i = 1,10
52    !ERROR: An ORDERED directive without the DEPEND clause must be closely nested in a worksharing-loop (or worksharing-loop SIMD) region with ORDERED clause without the parameter
53    !$omp ordered
54    do j = 1, 10
55       print *, "hello"
56    end do
57    !$omp end ordered
58  end do
59  !$omp end parallel
60end program omp_doOrdered
61