!> pgf90 -fast -r8 -o pointer-trouble pointer-trouble.f90
!> time ./pointer 
!> count          1750
!>
! user    0m5.744s
!
!> ifort -O3 -r8 -o pointer-ifort pointer.f90
!> time ./pointer-ifort 
! count        1750
!
! real    0m1.393s
!
module baz
implicit none
private
public :: foo
contains
  subroutine foo(time,maxpart,count)
    implicit none
    integer, intent(in) :: maxpart
    real, dimension(maxpart), intent(in) :: time
    integer, intent(out) :: count
    integer :: i
    !
    count=0
    do i=1,2000
      if (time(i) > 0.5) count=count+1
    end do
  end subroutine foo
end module baz

program pointer
  use baz
  implicit none
  type :: event_properties
    real :: t_last_collision
    real :: time_to_next_event,time_to_next_collision,time_to_next_transfer
    integer :: partner, cell
    character*12 :: event_type
    character*8 :: transfer_direction
  end type event_properties
  type (event_properties), allocatable, dimension(:) :: event
  integer, parameter :: maxpart=20000
  integer :: i,count
  real :: tmp
  !
  allocate(event(maxpart))
  !
  tmp=2.13
  !
  do i=1,maxpart
    event(i)%t_last_collision=0.002*i
 end do
  !
  do i=1,10000
    call foo(event%t_last_collision,maxpart,count)
  end do
  write(*,*) 'count',count
  deallocate(event)
end program pointer
