Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

About "Access voilation"

fenova
초급자
574 조회수
This problem has been solved. Thank U!
~~~~~~~~~~~~~~~~`
I called in two arraies
Type(EleLstTyp), Intent(In) :: EleLst(:)
Type(EleTyp), Intent(In) :: ETypLst(:)
~~
why I always met the error:
" forrtl: severe (157): Program Exception - access violation "
at this line:
Et = EleLst(Iel)%Etyp ;
Note that the error is only occur when I complied the code into release version, but
when I complied it into debug verion, I cannot encounter it.

The following is the part of my subroutine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Subroutine EleSteer(Ndim, Nels, Ntn, Neq, Glob_Coord, ENconn, NfArr, &
EleLst, ETypLst, g_g)
Use FE_types ;
Implicit None
Integer(4), Intent(In) :: Ndim, Nels, Ntn, Neq
Integer(4), Intent(In) :: ENconn(:, :), NfArr(:, :)
Real(kind=8), Intent(In) :: Glob_Coord(:, :)
Type(EleLstTyp), Intent(In) :: EleLst(:)
Type(EleTyp), Intent(In) :: ETypLst(:)
Integer(4), Intent(InOut) :: g_g(:, :)
! Local Variables
Integer(4) :: NBand, Iel, Inc, I, K, Ndn, Et
Integer(4), Allocatable :: g(:)
Allocate( g(MaxEleDofs) )
!
NBand = 0 ;
Do Iel = 1, Nels
g = 0 ; Inc = 0 ;
print*," iel = "
Et = EleLst(Iel)%Etyp ;
print*," Et = ", Et
Ndn = ETypLst(Et)%NdnEle ;
~~~~~~~~~~~~~~~~~~~~~~


Thank you for any helps!

Donald


0 포인트
2 응답
jimdempseyatthecove
명예로운 기여자 III
574 조회수

Donald,

Insert some sanity checks into your code

 if(.not. allocated(ETypLst)) then
write(*,*) 'Debug this' ! put breakpoint here
endif
Do Iel = 1, Nels
g = 0 ; Inc = 0 ;
print*," iel = "
Et = EleLst(Iel)%Etyp ;
print*," Et = ", Et
! assuming ETypLst(1:n)
if(Et .lt. 1) then
write(*,*) 'Debug this' ! put breakpoint here
endif
if(Et .gt. size(ETypLst)) then
write(*,*) 'Debug this' ! put breakpoint here
endif
Ndn = ETypLst(Et)%NdnEle ;
Jim Dempsey
0 포인트
jimdempseyatthecove
명예로운 기여자 III
574 조회수

Also,

If Subroutine EleSteer is compiled in a seperate project, and you are not using interfaces, then the caller may be calling using the address of the array as opposed to passing anarray descriptor.

Jim Dempsey

0 포인트
응답