Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Cannot see allocatable array elements within subroutine in debugger

$
0
0

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.

 

 


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>