Severe (157) Program Exception - Access Violation on an integer

Severe (157) Program Exception - Access Violation on an integer

I am a bit perplexed that I am getting an error for something that has so often worked for me in the past.  In a subroutine that I have written, I have an integer that when a value is specified, it creates the error mentioned in the subject heading.  I declare "implicit none" in both the parent program and the subroutine, and declare the variable (in this case KOUNT, I have also tried using K) an integer. The program compiles normally and runs until the PAUSE right before KOUNT=1.  Then I get the error, without KOUNT being printed.  I have experimented with different names for KOUNT.  Also, KOUNT is an index for the arrays RESAVG and ERRAVG, although KOUNT is not expected to reach 100001.  I have experiemented with smaller sizes of RESAVG and ERRAVG, and the program still has the error.  Initially, I had KOUNT=0, and thought that may be the problem, even though I have written other programs that successfully ran where that worked without issue.  Thoughts?

      SUBROUTINE CG(NXY,DXY,PHI,RESAVG,ERRAVG,KOUNT)
      
      IMPLICIT NONE
      
      INTEGER I,J,K,NXY,NODES,KOUNT

      DOUBLE PRECISION RESAVG(100001),ERRAVG(100001)

...

      RESA=1.0
      CTOL=1.0E-8
      PRINT *, RESA
      PRINT *, CTOL
      PAUSE
c     Establishes the convergence tolerance for the matrix

      KOUNT=1
      PRINT *, KOUNT
      PAUSE

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

it it probablya conflict between your declaration of Kount and how it is defined in the calling program or a mismatch in the arguments (which causes Kount to be declared imporperly) please post calling program definition of Kount and other variables being passed.

Please show the call to CG. My guess is that you are passing a literal value, such as 0, as the sixth (KOUNT) argument. That is not legal.

See also Don't Touch Me There - What error 157 (Access Violation) is trying to tell you

Steve - Intel Developer Support

Thanks.  Turns out you both were right.  I had added a variable in the main program without adding it to the calling program.  That part works fine now.  Now it is on to debugging the actual algorithm.

Leave a Comment

Please sign in to add a comment. Not a member? Join today