ok, here is a minimum example:
module mod_test_data
type type_f
integer:: n_f
real, dimension(:), allocatable:: f
end type type_f
type type_g
type(type_f), dimension(:), allocatable:: g
end type type_g
type(type_g):: h
end module mod_test_data
program testtest
use mod_test_data
implicit none
integer:: i, j
if(allocated(h%g)) deallocate(h%g)
allocate(h%g(1:20))
do i = 1, 20
h%g(i)%n_f = i
if(allocated(h%g(i)%f)) deallocate(h%g(i)%f)
allocate(h%g(i)%f(1:h%g(i)%n_f))
do j = 1, h%g(i)%n_f
h%g(i)%f(j) = i + j *2
enddo
enddo
print *, h%g(1)%f(1)
end program
The print statement at the end prints the correct value (3). But if you use the debugger and open the different flaps to see the respective values, the array viewer shows the value (3) at h%g(1)%f(20). There are also entries for h%g(1)%f(21) to h%g(1)%f(31) (without sense) displayed in the array viewer. What' wrong here ?
Cheers,
Klemens