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