Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner

Error 408 when writing a dummy array including stride

Hi all,

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?

Thanks,

Michael 

 

 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

0 Kudos
1 Reply
Highlighted
Moderator

 I am unable to reproduce

 I am unable to reproduce this in VS2015 + ifort 17.0.4 or 18.0 Beta.

Devorah - Intel® Developer Support
0 Kudos