module cafmod
   type co_double_3
      double precision, allocatable :: array(:)
   end type co_double_3
end module cafmod

program main
   use cafmod
   implicit none
      integer me
      type(co_double_3), codimension[*]::work
      me = this_image()
      call filter (work) 
      write(*,*)'On image',me,' size(work%array) = ', size(work%array)
!      deallocate( work%array )
contains
   subroutine filter (work) 
      type(co_double_3), codimension[*]::work
      logical alloc
      alloc = allocated(work%array)
       write(*,*)'On image',me,' allocated(work%array) = ', alloc
       if (alloc) deallocate( work%array )
       allocate( work%array(me) )
   end subroutine filter  
end program main
