Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28434 Discussions

Q about variables in Contained routines

William_S_1
Beginner
239 Views

Suppose I have:

----------------------------------------------------------------------------

SUBROUTINE SUB1

integer ix,iy,iz

contains

subroutine sub1a

integer iz

print *,ix,iy,iz

end subroutine

end

-------------------------------------------------------------------------

Now notice I have iz declared twice. Would that be local to the contained routine?

I assume that the contained routine can reference ix, and iy.

Incidentally, one debugging headache is that if I am within

the contained routine, at a breakpoint, I cannot reference

any variables that are not declared INSIDE that routine.

So even though the routine can reference those variables, the DEBUGGER can NOT get their values.

Is there a way around that?

so far I have to insert P

0 Kudos
2 Replies
William_S_1
Beginner
239 Views

To reference those variables with the debugger, I have to insert

print statements, which defeats the purpose of having it there.

Variables in the calling sequence CAN be referenced, though

as well as local variables.

0 Kudos
Steven_L_Intel1
Employee
239 Views

The iz you declare inside sub1a is local to the routine - ix and iy are "host associated". To see the variables in the host, use the "Stack Frame" pulldown to change the current frame to that of the outer routine.

Capture_8.PNG

0 Kudos
Reply