From 9ba6f6f2d1f35fbdbae481a2f817f891f4eacf6a Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Mon, 2 Sep 2013 18:34:15 +0000 Subject: [PATCH] *** empty log message *** --- base/modules/psb_i_vect_mod.F90 | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/base/modules/psb_i_vect_mod.F90 b/base/modules/psb_i_vect_mod.F90 index d86e7d10..27128d95 100644 --- a/base/modules/psb_i_vect_mod.F90 +++ b/base/modules/psb_i_vect_mod.F90 @@ -562,21 +562,24 @@ contains subroutine i_vect_cnv(x,mold) class(psb_i_vect_type), intent(inout) :: x - class(psb_i_base_vect_type), intent(in) :: mold + class(psb_i_base_vect_type), intent(in), optional :: mold class(psb_i_base_vect_type), allocatable :: tmp integer(psb_ipk_) :: info - if (.not.allocated(x%v)) return + + if (present(mold)) then #ifdef HAVE_MOLD - allocate(tmp,stat=info,mold=mold) + allocate(tmp,stat=info,mold=mold) #else - call mold%mold(tmp,info) + call mold%mold(tmp,info) #endif - call x%v%sync() - if (info == psb_success_) call tmp%bld(x%v%v) - call x%v%free(info) - call move_alloc(tmp,x%v) - + if (allocated(x%v)) then + call x%v%sync() + if (info == psb_success_) call tmp%bld(x%v%v) + call x%v%free(info) + end if + call move_alloc(tmp,x%v) + end if end subroutine i_vect_cnv end module psb_i_vect_mod