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

variables values in internal subroutines

Jump to solution

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

Accepted Solutions
Highlighted
New Contributor II
12 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
Highlighted
New Contributor II
13 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