Hello,
the following code compiles fine, but the debugger displays garbage for the array 'ar':
module fdmod integer :: maxar end module
program fdebug use fdmod maxar = 10 call subtest maxar = 20 call subtest end program
subroutine subtest use fdmod integer, dimension(maxar) :: ar ar(1:maxar) = 0 ar(2) = 5 write(,) ar(1),ar(2),lbound(ar),ubound(ar) end subroutine
I'm well aware that it is not hard to work around this problem, like passing the dimensionality to the subroutine. But it occurred in a more complex scenario in some very old sources. Also I'm not fully sure if it is legal fortran code as the array dimensions are variable bound. The code runs correctly as far as I can tell, the array resides on the stack (locally allocated) so it's not 'somewhere' in memory by accident.
The source compiles with e.g.
ftn95 /full_debug /restrict_syntax /iso fdebug.f90 /link
(ftn95 v5.21 reg) and also the intel compiler (v10) and gfortran have been checked, they compile without any complaint even when enabling all warnings.
Thanks.