Why does the text array fail to be allocated in the following code?:
ichar_len = 32
iarray_len = 1000
call text_allocatable(ichar_len,iarray_len)
.
.
.
subroutine text_allocatable(ichar_len,iarray_len)
character (len=ichar_len), allocatable, dimension(:) :: text_array
integer (kind=3), allocatable, dimension(:) :: isort_list
print *,ichar_len,iarray_len
allocate (text_array(iarray_len), stat=istat)
allocate (isort_list(iarray_len), stat=jstat)
print *,'allocation status',istat,jstat
if(istat .eq. 0)then
deallocate (text_array)
endif
if(jstat .eq. 0)then
deallocate (isort_list)
endif
end
Using (len=32) or parameter(ichar_len=32) instead of passing through the call statement works.
The Fortran 95 Handbook suggests that this will work. And assuming you have a copy, Section 6.5.1, Rules & restrictions item 10.
Regards
Ian