1! { dg-do compile }
2! PR 30146 - warn about DO variables as argument to INTENT(IN) and
3! INTENT(INOUT) dummy arguments
4program main
5  implicit none
6  integer :: i,j, k, l
7  do k=1,2                      ! { dg-error "undefined value" }
8     do i=1,10                  ! { dg-error "definable" }
9        do j=1,10               ! { dg-error "undefined value" }
10           do l=1,10            ! { dg-error "definable" }
11              call s_out(k)      ! { dg-error "undefined" }
12              call s_inout(i)    ! { dg-error "definable" }
13              print *,f_out(j)   ! { dg-error "undefined" }
14              print *,f_inout(l) ! { dg-error "definable" }
15           end do
16        end do
17     end do
18  end do
19contains
20  subroutine s_out(i_arg)
21    integer, intent(out) :: i_arg
22  end subroutine s_out
23
24  subroutine s_inout(i_arg)
25    integer, intent(inout) :: i_arg
26  end subroutine s_inout
27
28  function f_out(i_arg)
29    integer, intent(out) :: i_arg
30    integer :: f_out
31    f_out = i_arg
32  end function f_out
33
34  function f_inout(i_arg)
35    integer, intent(inout) :: i_arg
36    integer :: f_inout
37    f_inout = i_arg
38  end function f_inout
39
40end program main
41