Hi,
I think there is a bug with the following simplified code, ifort is giving forrtl: severe (151): allocatable array is already allocated, when compiled with ifort -fopenmp -O2. when compiled with -C it seems to give the good results.
module toto implicit none type t double precision,dimension(:),allocatable :: a contains procedure,pass :: copy_t generic,public :: assignment(=) => copy_t end type t contains subroutine copy_t(t1,t2) class(t),intent(in) :: t2 class(t),intent(out) :: t1 allocate(t1%a(size(t2%a)),source=t2%a) end subroutine end module toto
program foo
use toto use omp_lib implicit none type(t) :: g1,g2,g3 integer :: i,j !$omp parallel !$omp master allocate(g2%a(10),g3%a(10)) g2%a=-1 do i=1,10 !$omp task shared(g2,g3) private(g1) !$ print *,omp_get_thread_num(),allocated(g1%a) g1=g2 do j=1,20 g3%a=g1%a+j end do !$omp end task g2%a=i !$omp taskwait g1=g2 !$omp task shared(g3) firstprivate(g1) !$ print *,omp_get_thread_num(),allocated(g1%a) do j=1,20 g3%a=g1%a+j end do !$omp end task g2%a=i+1 !$omp taskwait end do print *,'g3a',g3%a !$omp end master !$omp end parallel end program foo