1module testmod
2  implicit none
3
4  contains
5
6  subroutine foo(n)
7    integer, intent(in) :: n
8    real :: r(0:n,-n:n), a(0:n,-n:n), dj
9    integer :: k, j
10
11    ! initialize with some dummy values
12    do j = -n, n
13      a(:, j) = j
14      r(:,j) = j + 1
15    end do
16
17    ! here be dragons
18    do k = 0, n
19      dj = r(k, k - 2) * a(k, k - 2)
20      r(k,k) = a(k, k - 1) * dj
21    enddo
22
23    if (r(0,0) .ne. -2.) STOP 1
24
25  end subroutine
26
27end module
28
29program test
30  use testmod
31  implicit none
32  call foo(5)
33end program
34