[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / omp-do15.f90
blob4cdc2bd91471890203c2c049c0d0a38d33c3f597
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1 -fopenmp
2 ! REQUIRES: shell
3 ! OpenMP Version 4.5
4 ! 2.7.1 Loop Construct
6 program omp
7 integer i, j, k
9 !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.
10 !$omp do collapse(3)
11 do i = 0, 10
12 if (i .lt. 1) then
13 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
14 cycle
15 end if
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
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 if (i .lt. 1) then
29 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
30 cycle
31 end if
32 do k = 0, 10
33 print *, i, j, k
34 end do
35 end do
36 end do
37 !$omp end do
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(2)
41 foo: do i = 0, 10
42 foo1: do j = 0, 10
43 if (i .lt. 1) then
44 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
45 cycle foo
46 else if (i .gt. 3) then
47 cycle foo1
48 end if
49 do k = 0, 10
50 print *, i, j, k
51 end do
52 end do foo1
53 end do foo
54 !$omp end do
57 !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.
58 !$omp do collapse(3)
59 foo: do i = 0, 10
60 foo1: do j = 0, 10
61 if (i .lt. 1) then
62 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
63 cycle foo
64 else if (i .gt. 3) then
65 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
66 cycle foo1
67 end if
68 foo2: do k = 0, 10
69 print *, i, j, k
70 end do foo2
71 end do foo1
72 end do foo
73 !$omp end do
75 !$omp do ordered(3)
76 foo: do i = 0, 10
77 foo1: do j = 0, 10
78 foo2: do k = 0, 10
79 if (i .lt. 1) then
80 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
81 cycle foo
82 else if (i .gt. 3) then
83 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
84 cycle foo1
85 else
86 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
87 cycle foo
88 end if
89 print *, i, j, k
90 end do foo2
91 end do foo1
92 end do foo
93 !$omp end do
95 end program omp