Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26729 Discussions

Error 408 when writing a dummy array including stride

Michael_R_3
Beginner
110 Views

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
Devorah_H_Intel
Moderator
110 Views

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

Reply