module myclean_arrays
  !
  type :: telesco
    character(len=12) :: ctele
  end type telesco
  !
  type :: gildas
    type(telesco), allocatable :: teles(:)
  end type gildas
  !
  type (gildas) :: hbeam
  !
end module myclean_arrays
!
program gtemplate
  use myclean_arrays
  ! Local
  integer(kind=4) :: jfield
  !
  allocate(hbeam%teles(1))
  hbeam%teles(1)%ctele = 'NOEMA'
  !
  !$OMP PARALLEL DEFAULT(none) &
  !$OMP   & FIRSTPRIVATE(hbeam) &
  !$OMP   & PRIVATE(jfield)
  !$OMP DO
  !
  do jfield=1,1000
    if (allocated(hbeam%teles)) deallocate(hbeam%teles)
  enddo
  !
  !$OMP END DO
  !$OMP END PARALLEL
  !
end program gtemplate
