MODULE recTaskCall USE ISO_C_BINDING CONTAINS ! Simple test routine, that recursively calls rec_low and increments counter until nlevels is reached ! The recursive calls are done suing OMP TASKS. The problem appears to be the access to nlevels which is global in this ! scope but is not accessible from within the tasks SUBROUTINE rec_in (nlevels) INTEGER :: nlevels !$OMP PARALLEL SHARED(nlevels) DEFAULT(NONE) !$OMP SINGLE CALL rec_low(0) !$OMP END SINGLE !$OMP END PARALLEL CONTAINS RECURSIVE SUBROUTINE rec_low(idepth) INTEGER :: idepth IF (idepth== nlevels) RETURN !$OMP TASK CALL rec_low(idepth+1) !$OMP END TASK END SUBROUTINE END SUBROUTINE END MODULE PROGRAM testme USE recTaskCall CALL rec_in(3) END PROGRAM