program driver
  use mymodule

  implicit none

  integer i, j
  integer, target :: ind (1000)
  type(i1_t), target :: i1 (1000)
  type(elt_t), target :: elts (1000)
  real, target :: array (1000)
  type(elt_t), pointer :: elts_ptr(:)
  real, pointer :: array_ptr(:)

  elts_ptr => elts
  array_ptr => array

  do i = 1, 1000
     ind(i) = i
     i1(i)%val => ind
     elts(i)%p => i1(i)
  end do

  do i = 1, 500
     call myroutine (1000, 1000, elts_ptr, array_ptr)
  end do
end program driver
