Question about allocatable functions in gfortran
Steve Kargl
sgk@troutmask.apl.washington.edu
Wed Jul 28 02:48:00 GMT 2010
On Tue, Jul 27, 2010 at 06:58:25PM -0700, Jerry DeLisle wrote:
> length_call: 0
> At line 23 of file alloc.f90
> Fortran runtime error: Attempt to DEALLOCATE unallocated 'vector_call'
>
Which is somewhat correct.
function random_vector() result(vector)
implicit none
real, dimension(:), allocatable :: vector
integer :: length
real :: length_real
if (allocated(vector)) deallocate(vector)
The above statement is invalid (at least upon the
first call to random_vector, and probably all
calls after that but I would need to think about the
code too much). I suspect that one can simply
delete that statement.
--
Steve
More information about the Fortran
mailing list