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

variables values in internal subroutines

LRaim
New Contributor I
289 Views

Using Visual Studio Professional 2015 and Compiling with Intel(R) Visual Fortran Compiler 16.0 [Intel(R) 64] variables defined in the main subroutine are not visible in an internal subroutine. Has this problem been fixed ? Attached is a screen shot . This is a severe debugging noise.
I had to zip the jpeg image since its upload was rejected.
Regards

 

 

0 Kudos
1 Solution
Mark_Lewy
Valued Contributor I
289 Views

My findings with XE 2017 Update 4 (latest released version) and VS 2015 Update 3:

1) A host associated variable which is used in an internal subprogram can be watched from that subprogram.

2) A host associated variable which is not used in an internal subprogram cannot be watched from that subprogram; you have to select the host subprogram in the call stack to watch it.

For example,

program sandbox
    implicit none

    real :: r
    integer :: i

    r = 42
    i = 6
    call x
contains
    subroutine x
        print*, r
    end subroutine x
end program sandbox

If I put a breakpoint on the print statement in subroutine x, only "R" appears in the Locals view.  If I type "i" in a Watch window, "Undefined variable i" is displayed in the Value column.  If I then select sandbox.exe!SANDBOX() Line 24 on the Call Stack the correct value of i (6) is displayed in the Value column.

View solution in original post

0 Kudos
1 Reply
Mark_Lewy
Valued Contributor I
290 Views

My findings with XE 2017 Update 4 (latest released version) and VS 2015 Update 3:

1) A host associated variable which is used in an internal subprogram can be watched from that subprogram.

2) A host associated variable which is not used in an internal subprogram cannot be watched from that subprogram; you have to select the host subprogram in the call stack to watch it.

For example,

program sandbox
    implicit none

    real :: r
    integer :: i

    r = 42
    i = 6
    call x
contains
    subroutine x
        print*, r
    end subroutine x
end program sandbox

If I put a breakpoint on the print statement in subroutine x, only "R" appears in the Locals view.  If I type "i" in a Watch window, "Undefined variable i" is displayed in the Value column.  If I then select sandbox.exe!SANDBOX() Line 24 on the Call Stack the correct value of i (6) is displayed in the Value column.

0 Kudos
Reply