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

cannot see the value of an allocatable array of derived type variable in VS debugger

pan__li
Beginner
224 Views

I am using VS2012, and my code is as below, also the file is attached.

my problem is that I cannot see the 'v' component (that is allocatable) of x array at a break point in subroutine sr2, even though I can print it.

it is interesting that we have no problem in seeing the 'a' component of x array.

what is the reason? how to fix it?

Thanks!

 

code:

~~~~~~~~~~~~~~~~~~~~~~~~~~~

    MODULE dtype

    IMPLICIT NONE
    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    type dt

        real*8, Dimension(:),   allocatable :: v
        real*8 :: a

    end type dt


    end Module dtype
    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    subroutine  sr1(x)
    use dtype
    implicit none

    type(dt) x

    allocate(x%v(3))
    x%v=[1.0, 2.0, 3.0]

    end subroutine sr1
    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    subroutine  sr2(x)
    use dtype
    implicit none

    type(dt) x(3)
    call sr1(x(1))
    call sr1(x(2))
    call sr1(x(3))

    write(*,*) 'break point here. We cannot see the value of v component of x array in debugger, but we can print it'
    write(*,*) x(1)%v

    end subroutine sr2
    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    program main


    use dtype
    implicit none
    type(dt) x(3)
    call sr2(x(1:3))

    write(*,*) x(1)%v
    pause

    end program main

0 Kudos
0 Replies
Reply