Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / do08.f90
blob3ba63072a80bdcf23469ca10be405e3ee8420b4a
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2 ! OpenMP Version 4.5
3 ! 2.7.1 Loop Construct
5 program omp
6 integer i, j, k
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 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
12 if (i .lt. 1) cycle
13 do j = 0, 10
14 do k = 0, 10
15 print *, i, j, k
16 end do
17 end do
18 end do
19 !$omp end do
21 !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.
22 !$omp do collapse(3)
23 do i = 0, 10
24 do j = 0, 10
25 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
26 if (i .lt. 1) cycle
27 do k = 0, 10
28 print *, i, j, k
29 end do
30 end do
31 end do
32 !$omp end do
34 !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.
35 !$omp do collapse(2)
36 do i = 0, 10
37 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
38 if (i .lt. 1) cycle
39 do j = 0, 10
40 do k = 0, 10
41 print *, i, j, k
42 end do
43 end do
44 end do
45 !$omp end do
48 !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.
49 !$omp do collapse(2)
50 foo: do i = 0, 10
51 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
52 if (i .lt. 1) cycle foo
53 do j = 0, 10
54 do k = 0, 10
55 print *, i, j, k
56 end do
57 end do
58 end do foo
59 !$omp end do
62 !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.
63 !$omp do collapse(3)
64 do 60 i=2,200,2
65 do j=1,10
66 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
67 if(i==100) cycle
68 do k=1,10
69 print *,i
70 end do
71 end do
72 60 continue
73 !$omp end do
75 !$omp do collapse(3)
76 foo: do i = 0, 10
77 foo1: do j = 0, 10
78 foo2: do k = 0, 10
79 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
80 if (k .lt. 1) cycle foo
81 print *, i, j, k
82 end do foo2
83 end do foo1
84 end do foo
85 !$omp end do
87 !$omp do collapse(3)
88 foo: do i = 0, 10
89 foo1: do j = 0, 10
90 foo2: do k = 0, 10
91 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
92 if (k .lt. 1) cycle foo1
93 print *, i, j, k
94 end do foo2
95 end do foo1
96 end do foo
97 !$omp end do
100 !$omp do collapse(2)
101 foo: do i = 0, 10
102 foo1: do j = 0, 10
103 foo2: do k = 0, 10
104 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
105 if (k .lt. 1) cycle foo
106 print *, i, j, k
107 end do foo2
108 end do foo1
109 end do foo
110 !$omp end do
113 !$omp do ordered(2)
114 foo: do i = 0, 10
115 foo1: do j = 0, 10
116 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
117 if (k .lt. 1) cycle foo
118 foo2: do k = 0, 10
119 print *, i, j, k
120 end do foo2
121 end do foo1
122 end do foo
123 !$omp end do
125 !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.
126 !$omp do collapse(2) ordered(3)
127 foo: do i = 0, 10
128 foo1: do j = 0, 10
129 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
130 if (k .lt. 1) cycle foo
131 foo2: do k = 0, 10
132 print *, i, j, k
133 end do foo2
134 end do foo1
135 end do foo
136 !$omp end do
138 end program omp