1! RUN: %S/test_errors.sh %s %t %f18
2! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if
3! it belongs to that construct or an outer construct.
4
5subroutine do_concurrent_test1(n)
6  implicit none
7  integer :: n
8  integer :: j,k
9  mydoc: do concurrent(j=1:n)
10  mydo:    do k=1,n
11!ERROR: EXIT must not leave a DO CONCURRENT statement
12             if (k==5) exit mydoc
13             if (j==10) exit mydo
14           end do mydo
15         end do mydoc
16end subroutine do_concurrent_test1
17
18subroutine do_concurrent_test2(n)
19  implicit none
20  integer :: j,k,n
21  mydoc: do concurrent(j=1:n)
22!ERROR: EXIT must not leave a DO CONCURRENT statement
23           if (k==5) exit
24         end do mydoc
25end subroutine do_concurrent_test2
26
27subroutine do_concurrent_test3(n)
28  implicit none
29  integer :: j,k,n
30  mytest3: if (n>0) then
31  mydoc:    do concurrent(j=1:n)
32              do k=1,n
33!ERROR: EXIT must not leave a DO CONCURRENT statement
34                if (j==10) exit mytest3
35              end do
36            end do mydoc
37          end if mytest3
38end subroutine do_concurrent_test3
39
40subroutine do_concurrent_test4(n)
41  implicit none
42  integer :: j,k,n
43  mytest4: if (n>0) then
44  mydoc:    do concurrent(j=1:n)
45              do concurrent(k=1:n)
46!ERROR: EXIT must not leave a DO CONCURRENT statement
47                if (k==5) exit
48!ERROR: EXIT must not leave a DO CONCURRENT statement
49!ERROR: EXIT must not leave a DO CONCURRENT statement
50                if (j==10) exit mytest4
51              end do
52            end do mydoc
53          end if mytest4
54end subroutine do_concurrent_test4
55