program main
  implicit none
  integer, volatile, dimension(1) :: n
  real, allocatable :: a(:)
  integer :: i, j, pos, ub, lb
  real :: t1, t2, limit

  allocate (a(100))
  call random_number(a) ! negligible time
  !call cpu_time(t1)
  do i=1, 10000000
    limit = 3.4028234663852885981170418348451692544e+38;
    lb = lbound(a,dim=1)
    ub = ubound(a,dim=1)
    if (lb <= ub) then
      pos = 1
    else
      pos = 0
    end if
    do j = lb, ub
      if (a(j) < limit) then
        limit = a(j)
        pos = j
      end if
    end do
    n = pos
  end do
  !call cpu_time(t2)
 print *, n !, t2-t1
end program main
