My code sets a variable IC2:
IC2 = IFLAGS(17,JCONF)
A few lines later it uses this value, which equals the number 2:
JCOL = IC2
Then, later I use it again:
DO K = 1,JTRAN ! RETRACE ENTIRE RAYSET, THIS TIME TO GET GLASS ABSORPTION
XEN = XR(K) ! USE ONLY RAYS THAT GOT THROUGH LAST TIME
YEN = YR(K)
AT = AT + AR(K) ! APODIZATION ONLY
IF (JPOLD(JCONF) .EQ. 1) THEN ! POLARIZATION OFF; NO LOSS FROM THAT
XYAR(K) = 1.0
BT = BT + XYAR(K) ! COATINGS ONLY
ISTOP = MX
ICOL = IC2
Only this time I get an error saying that IC2 is not defined! In the debugger it still has the value it had when defined earlier. What's going on?
Does the error occur in an OpenMP region with default(none)?
Or, is the variable IC2 or lC2?
Note, left variable has upper case i and the right variable is lower case L
I may add that I always use the option "Local Variables AUTOMATIC (/Qauto) " which means the locals become undefined when you exit the subroutine rather than saving the last value used which often masks many "uninitialised" variable errors. With a old program you will find this option throws up quite a number of errors but in reality these are all bugs that should be fixed.