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

Severe (157): Program Exception - acess violation.

mdiarra2
Beginner
576 Views
Hi there,
i'm getting this error when running my code under windows xp at the line 58 below.
if i uncheck "array and string bounds" before compiling, the code stops at line 57 with severe <161> : array bounds exceeded.
So now, after two nights, i think i need an external eye if someone can help, i would appreciate
Thanks in advance
Moussa
! arguments
!
TYPE(subdom_descriptor) :: subdom
TYPE(interf_descriptor), DIMENSION(subdom%numb_neighb) :: intf
INTEGER neq_mask
INTEGER, DIMENSION(neq_mask) :: list_mask_eq
!
! local variables
!
INTEGER ierr,n,m,ns,nt,i,neq
CHARACTER(3) :: cns
INTEGER, ALLOCATABLE, DIMENSION(:) :: mask,list_eq
!
...............................................................................................................
Line
53 loop_ns: &
54 &DO ns=1,subdom%numb_neighb
55 neq=0
56 DO n=1,intf(ns)%neq
57 IF(mask(intf(ns)%list_eq(n)) == 0) THEN
58 neq=neq+1
59 END IF
60 END DO
61 IF(neq == intf(ns)%neq) CYCLE loop_ns
..........................................................................................................................
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
576 Views
It's difficult that we say anything without having entire code in the debugger. Well, what does the debugger say about values of intf(ns)%list_eq(n) and mask() of it?
0 Kudos
jimdempseyatthecove
Honored Contributor III
576 Views

If you uncheck "array and string bounds" and see "array bounds exceeded" then your program is likely referencing an address that is outside the virtual address space of the program data space. If the array pointer is uninitialized (is NULL or negative junk) then you might see this error message. If your program simply indexed outside of the range of the array (with uncheck "array and string bounds") then you would likely see no error message.

Insert the following code

Code:

57 cDEC$ IF(.TRUE.)
58 ! use associated or allocated on following statement
59  if(.not. associated(intf)) call DOSTOP('(.not. associated(intf))')
60 ! assuming array begins at 1
61  if(ns .lt. 1) call DOSTOP('(ns .lt. 1))')
62  if(ns .gt. size(intf)) call DOSTOP('(ns .gt. size(intf)) ')
63 if(.not. associated(intf(ns)%list_eq)) call DOSTOP('(.not. associated(intf(ns)%list_eq))')
64  if(n .lt. 1) call DOSTOP('(n .lt. 1))')
65  if(n .gt. size(intf(ns)%list_eq)) call DOSTOP('(n .gt. size(intf(ns)%list_eq)) ')
66 cDEC$ ENDIF
67  IF(mask(intf(ns)%list_eq(n)) == 0) THEN



Add a subroutine DOSTOP that takes a character string, prints it then stops (or pause and stops).

Jim Dempsey

0 Kudos
Reply