Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
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

Program Exception - array bounds exceeded



I have a problem while running a fixed format Fortran program.

I use IMSL to calculate a integral equation: F(T)=exp(-Ea/T) dT, where Ea is a 5*3 matrix of random number.

Somehow the integral equation in the real function F(T) can't read the value Ea which is defined in main program.

When I execute the program, it shows "forrtl : severe <161> : Program Exception - array bounds exceeded"

Therefore, I would like to ask how to read the value from main program and execute successfully.

Thank you!


Here is the entire program,

program main
    use imsl
    implicit real*8 (a-h,o-z)
    integer NOUT
    real, external :: F
    real D,U
    real, parameter :: errabs = 1E-5
    real, parameter :: errrel = 1E-5
    real ans, err
    real Ea(12,12)
    common Ea,i,k


! initail random Ea
    Do k=1,No_of_agen
      Do i=1,No_of_comp  

        call random_number(rn01)

        write(*,*) Ea(k,i)
      end do
    end do

! integral of each Ea
    Do 10 k=1,No_of_agen
      Do 20 i=1,No_of_comp

        Call QDAGS (F, D, U, errabs, errrel, ans, err)

        write(*,*) ans

20   continue
10  continue


    real function F(T)
    implicit real*8 (a-h,o-z)
    real Ea(12,12)
    real T
    common /part1/ Ea,i,k
    F = EXP(-Ea(k,i)/T)
      write(*,*) Ea(k,i)

    end function

0 Kudos
2 Replies
Black Belt

You have two different common blocks. The one in the main program is blank common, and the one in the subroutine is labeled /part1/ . Make the two blocks the same.

If you intend to call QDAGS using the implicit (F77) interface, do not have a USE IMSL... statement in the caller. The F95+ interface has the RESULT variable as the fourth argument, whereas the implicit interface contains ERRABS in that position.


Thank you so much!

The problem has been solved!

Thank you!