Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
31 Views

Uninitialized variable with correct value

Jump to solution

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
        ENDIF
        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?

0 Kudos

Accepted Solutions
Highlighted
New Contributor I
31 Views

My bad.  I had a dimension mismatch.  Fixed it.

 

 

View solution in original post

0 Kudos
3 Replies
Highlighted
New Contributor I
32 Views

My bad.  I had a dimension mismatch.  Fixed it.

 

 

View solution in original post

0 Kudos
Highlighted
31 Views

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

Jim Dempsey

0 Kudos
Highlighted
Valued Contributor III
31 Views

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.

0 Kudos