Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26734 Discussions

Uninitialized variable with correct value

Don_D_
New Contributor I
138 Views

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
1 Solution
Don_D_
New Contributor I
138 Views

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

 

 

View solution in original post

3 Replies
Don_D_
New Contributor I
139 Views

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

 

 

View solution in original post

jimdempseyatthecove
Black Belt
138 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

andrew_4619
Honored Contributor I
138 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.

Reply