diff --git a/mpp/include/mpp_gather.fh b/mpp/include/mpp_gather.fh index 6c40dc4e8f..82fbdec609 100644 --- a/mpp/include/mpp_gather.fh +++ b/mpp/include/mpp_gather.fh @@ -127,12 +127,15 @@ subroutine MPP_GATHER_PELIST_GEN_2D_(is, ie, js, je, pelist, array_seg, gather_d MPP_TYPE_, pointer :: arr3D(:,:,:) MPP_TYPE_, pointer :: data3D(:,:,:) + MPP_TYPE_, allocatable, target :: empty3D(:,:,:) arr3D(1:size(array_seg,1),1:size(array_seg,2),1:1) => array_seg + if (is_root_pe) then - data3D(1:size(gather_data,1),1:size(gather_data,2),1:1) => gather_data + data3D(1:size(gather_data,1),1:size(gather_data,2),1:1) => gather_data else - data3D => null() + allocate(empty3D(0,0,0)) + data3D => empty3D endif call mpp_gather(is, ie, js, je, 1, pelist, arr3D, data3D, [dim_order, 3], is_root_pe, & diff --git a/mpp/include/mpp_scatter.fh b/mpp/include/mpp_scatter.fh index b0e5c5d126..49344b424b 100644 --- a/mpp/include/mpp_scatter.fh +++ b/mpp/include/mpp_scatter.fh @@ -52,12 +52,14 @@ subroutine MPP_SCATTER_PELIST_GEN_2D_(is, ie, js, je, pelist, array_seg, input_d MPP_TYPE_, pointer :: arr3D(:,:,:) MPP_TYPE_, pointer :: data3D(:,:,:) + MPP_TYPE_, allocatable, target :: empty3D(:,:,:) arr3D(1:size(array_seg,1),1:size(array_seg,2),1:1) => array_seg if (is_root_pe) then data3D(1:size(input_data,1),1:size(input_data,2),1:1) => input_data else - data3D => null() + allocate(empty3D(0,0,0)) + data3D => empty3D endif call mpp_scatter(is, ie, js, je, 1, pelist, arr3D, data3D, [dim_order, 3], is_root_pe) diff --git a/test_fms/mpp/test_mpp_pelist_gatscat_gen_ind.F90 b/test_fms/mpp/test_mpp_pelist_gatscat_gen_ind.F90 index 66372d1e82..819fddd41d 100644 --- a/test_fms/mpp/test_mpp_pelist_gatscat_gen_ind.F90 +++ b/test_fms/mpp/test_mpp_pelist_gatscat_gen_ind.F90 @@ -131,8 +131,6 @@ subroutine alloc_field(field, dim_order, dims_logical, pe, root, is_global) allocate(field(dims(dim_order(1)), & dims(dim_order(2)), & dims(dim_order(3)))) - else - allocate(field(1,1,1)) endif else dims = dims_logical