diff --git a/src/neasyf.f90 b/src/neasyf.f90 index f6c1051..dc5d40c 100644 --- a/src/neasyf.f90 +++ b/src/neasyf.f90 @@ -280,43 +280,57 @@ end function neasyf_type_scalar function neasyf_type_rank1(variable) result(nf_type) integer(nf_kind) :: nf_type class(*), dimension(:), intent(in) :: variable - nf_type = neasyf_type(variable(1)) + class(*), dimension(:), allocatable :: local + allocate(local(1), mold=variable) + nf_type = neasyf_type(local(1)) end function neasyf_type_rank1 function neasyf_type_rank2(variable) result(nf_type) integer(nf_kind) :: nf_type class(*), dimension(:, :), intent(in) :: variable - nf_type = neasyf_type(variable(1, 1)) + class(*), dimension(:, :), allocatable :: local + allocate(local(1, 1), mold=variable) + nf_type = neasyf_type(local(1, 1)) end function neasyf_type_rank2 function neasyf_type_rank3(variable) result(nf_type) integer(nf_kind) :: nf_type class(*), dimension(:, :, :), intent(in) :: variable - nf_type = neasyf_type(variable(1, 1, 1)) + class(*), dimension(:, :, :), allocatable :: local + allocate(local(1, 1, 1), mold=variable) + nf_type = neasyf_type(local(1, 1, 1)) end function neasyf_type_rank3 function neasyf_type_rank4(variable) result(nf_type) integer(nf_kind) :: nf_type class(*), dimension(:, :, :, :), intent(in) :: variable - nf_type = neasyf_type(variable(1, 1, 1, 1)) + class(*), dimension(:, :, :, :), allocatable :: local + allocate(local(1, 1, 1, 1), mold=variable) + nf_type = neasyf_type(local(1, 1, 1, 1)) end function neasyf_type_rank4 function neasyf_type_rank5(variable) result(nf_type) integer(nf_kind) :: nf_type class(*), dimension(:, :, :, :, :), intent(in) :: variable - nf_type = neasyf_type(variable(1, 1, 1, 1, 1)) + class(*), dimension(:, :, :, :, :), allocatable :: local + allocate(local(1, 1, 1, 1, 1), mold=variable) + nf_type = neasyf_type(local(1, 1, 1, 1, 1)) end function neasyf_type_rank5 function neasyf_type_rank6(variable) result(nf_type) integer(nf_kind) :: nf_type class(*), dimension(:, :, :, :, :, :), intent(in) :: variable - nf_type = neasyf_type(variable(1, 1, 1, 1, 1, 1)) + class(*), dimension(:, :, :, :, :, :), allocatable :: local + allocate(local(1, 1, 1, 1, 1, 1), mold=variable) + nf_type = neasyf_type(local(1, 1, 1, 1, 1, 1)) end function neasyf_type_rank6 function neasyf_type_rank7(variable) result(nf_type) integer(nf_kind) :: nf_type class(*), dimension(:, :, :, :, :, :, :), intent(in) :: variable - nf_type = neasyf_type(variable(1, 1, 1, 1, 1, 1, 1)) + class(*), dimension(:, :, :, :, :, :, :), allocatable :: local + allocate(local(1, 1, 1, 1, 1, 1, 1), mold=variable) + nf_type = neasyf_type(local(1, 1, 1, 1, 1, 1, 1)) end function neasyf_type_rank7 diff --git a/src/neasyf.type.in.f90 b/src/neasyf.type.in.f90 index b1acaca..8b87d02 100644 --- a/src/neasyf.type.in.f90 +++ b/src/neasyf.type.in.f90 @@ -1,5 +1,7 @@ function neasyf_type_rank{n}(variable) result(nf_type) integer(nf_kind) :: nf_type class(*), dimension({array(n)}), intent(in) :: variable - nf_type = neasyf_type(variable({slice(n)})) + class(*), dimension({array(n)}), allocatable :: local + allocate(local({slice(n)}), mold=variable) + nf_type = neasyf_type(local({slice(n)})) end function neasyf_type_rank{n}