xref: /llvm-project/flang/test/Semantics/OpenMP/do16.f90 (revision 502bea25bdc07d1811b8bfea1c2e6bfa8617f72f)
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2! OpenMP Version 4.5
3! 2.7.1 Loop Construct
4
5program omp
6  integer i, j, k
7
8  !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.
9  !$omp do  collapse(3)
10  do i = 0, 10
11    select case (i)
12    case(1)
13      !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
14      cycle
15    end select
16    do j = 0, 10
17      do k  = 0, 10
18        print *, i, j, k
19      end do
20    end do
21  end do
22  !$omp end do
23
24  !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.
25  !$omp do  collapse(3)
26  do i = 0, 10
27    do j = 0, 10
28      select case (i)
29      case(1)
30        !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
31        cycle
32      end select
33      do k  = 0, 10
34        print *, i, j, k
35      end do
36    end do
37  end do
38  !$omp end do
39
40  !$omp do  collapse(2)
41  foo: do i = 0, 10
42    foo1: do j = 0, 10
43      select case (i)
44      case(1)
45        !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
46        cycle foo
47      case(5)
48        cycle foo1
49      end select
50      do k  = 0, 10
51        print *, i, j, k
52      end do
53    end do foo1
54  end do foo
55  !$omp end do
56
57  !$omp do  ordered(3)
58  foo: do i = 0, 10
59    foo1: do j = 0, 10
60      foo2: do k  = 0, 10
61        select case (i)
62        case(1)
63          !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
64          cycle foo
65        case(5)
66          !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
67          cycle foo1
68        case(7)
69          cycle foo2
70        end select
71        print *, i, j, k
72      end do foo2
73    end do foo1
74  end do foo
75  !$omp end do
76
77end program omp
78