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

Cannot see allocatable array elements within subroutine in debugger

Terry_Wong
Beginner
1,075 Views

I am using Visual Studio 2012 (version 11.060315.01 Update 2), and Intel Fortran w_fcompxe_2013_sp1.1.139.

I am having difficulty seeing member variables of a user defined type in the debugger.

First, I define a type within a module.

module module1_mod
  public
  type testtype
    integer, allocatable, dimension(:) :: ipt1
    real, allocatable, dimension(:) :: rpt1
  end type testtype

end module module1_mod

Note that this problem will fail with the members of the type being pointers instead of allocatable arrays also.

I have a program which passes a variable of type testtype to the subroutine.

    program Console1
    use module1_mod

    implicit none

    ! Variables
    type(testtype) :: amod
    real :: arr(15)
    interface asub
      subroutine asub(amod, arr)
      use module1_mod
     type(testtype), target :: amod
     real :: arr(:)     
      end subroutine asub
    end interface asub

      allocate(amod%ipt1(10))
      amod%ipt1 = 1
      allocate(amod%rpt1(10))
      amod%rpt1 = 10.
      arr = 15.
      
      call asub(amod, arr)

    end program Console1

 

I have even added an explicit interface so there is no ambiguity.

 

I call the subroutine:

 

subroutine asub(amod, arr)
    use module1_mod
    type(testtype), target :: amod
    real :: arr(:)
    type(testtype), pointer :: pt
    pt => amod
  
    amod%ipt1 = amod%ipt1 + 2
    return
  
end subroutine asub

 

In the debugger, I cannot see the elements of amod.  amod%ipt1 shows {...} but cannot be expanded; amod%rpt1 shows undefined address.

However, I can see the elements of the local pointer pt fine.

 

 

0 Kudos
1 Solution
Georg_Z_Intel
Employee
1,075 Views

Hello,

we're aware about the problem you described. For Intel(R) Composer XE 2013 SP1 Update 2 (released beginning February) it should be fixed. Please let us know whether it also works for you.

Best regards,

Georg Zitzlsberger

View solution in original post

0 Kudos
3 Replies
IanH
Honored Contributor III
1,075 Views

This may not be relevant to your particular problem (I don't have VS2012 to test), but something to try - after the line in the watch window for the array or array component, that won't expand add a watch for a simple scalar.  Often that seems to encourage the watch window to start behaving itself.

The other thing to try is to run the application a second time (the debugger appears to have more issues when debugging immediately after a build than it does debugging a second or subsequent run).

Also, using the immediate watch tip thing (move the mouse pointer over the name of the variable of interest, expand things) before using the watch window sometimes encourages the watch window to work.

Rather bizarre, but [occasionally, with poor reproducibility] true!

 

0 Kudos
Terry_Wong
Beginner
1,075 Views

Thanks for your suggestions.

I tried them but none of them were effective.

0 Kudos
Georg_Z_Intel
Employee
1,076 Views

Hello,

we're aware about the problem you described. For Intel(R) Composer XE 2013 SP1 Update 2 (released beginning February) it should be fixed. Please let us know whether it also works for you.

Best regards,

Georg Zitzlsberger

0 Kudos
Reply