Hi,
I've just noticed that my debugger was not always showing contents of internal subprogram variables. I've made a few observations based on the test program below.
1. The local variables defined in the internal subprogram can be watched without any problem.
2. When the internal subprogram is within the external subroutine, none of the variables can be watched if they are defined in the calling subprogram. In other words, I could not watch all the host associated variables.
3. If the internal subprogram is contained within the main program, I got mixed results for the host associated variables. In the test program, I could watch array variable 'area' but not the integer 'nsize'.
Note that the program itself is working as intended. I am having only debugger watching variable issue. Is there any debugger setting that I can try to resolve this ?
My system: Windows 7 64-bits SP1, Parallel Studio, XE 2016 Composer, VS Premium 2013, MS Visual C++ 2010 x64 redistributable, MS Visual C++ 2010 x86 redistributable,
Thanks,
Moonkyu
Program Main
IMPLICIT NONE
INTEGER :: nsize
REAl, DIMENSION(5) :: area = (/1.0, 2.0, 3.0, 4.0, 5.0/)
REAL :: sum_area, ave_area, ave1_area, ave2_area
sum_area=SUM(area)
nsize=SIZE(area)
ave_area=sum_area/nsize
CALL find_ave1(ave1_area)
CALL find_ave2(area, nsize, ave2_area)
CONTAINS
SUBROUTINE find_ave1(average)
INTEGER :: i
REAL :: average
average = 0.0
DO i = 1, nsize
average = average + area(i)
END DO
average=average/nsize
END SUBROUTINE find_ave1
END PROGRAM
SUBROUTINE find_ave2 (array, nsize, average)
! subroutine to find the average of the 'array'
IMPLICIT NONE
INTEGER :: nsize
REAL :: array(nsize), sumval, average
CALL find_sum
average = sumval/nsize
CONTAINS
SUBROUTINE find_sum
! internal subprogram to find the sum of 'array'
INTEGER :: i
sumval = 0.0
DO i=1, nsize
sumval = sumval + array(i)
END DO
END SUBROUTINE
END SUBROUTINE find_ave2