I'm getting a strange array out of bounds error when I try to print a 2D array by row in a contained procedure. I'm using the latest version of IVF with VS Community 2015 and all the default settings.
I have a hacky fix which is included in the snippet below, but just wondered if anyone could help; am I at fault, or is this a bug? I think its something to do with allocating a temporary array for a write statement, but perhaps someone who knows a bit more could explain?
program LowerBoundError implicit none integer, parameter :: dim = 3 double precision :: bigVector( dim * dim ) integer :: iGlb ! Initialize bigVector = 0 call WriteArrays( dim, bigVector ) contains subroutine WriteArrays( d, b ) integer, intent(in) :: d double precision, intent(in) :: b(:) double precision :: tmp(d) integer :: i write(*,*) d write(*,*) b ! write by row do i = 1, d ! This crashes write(*,*) b( i : : d ) ! However this works tmp = b( i : : d ) write(*,*) tmp end do end subroutine WriteArrays end program LowerBoundError
and the error message:
an error forrtl: severe (408): fort: (3): Subscript #1 of the array B has value -858993460 which is less than the lower bound of 1