Nvfortran cannot compile a pure-procedure pointer in a do concurrent loop

gfortran and ifort can compile the following code, nvfortran 22.1 cannot.
! NVFORTRAN-S-0488-Subprogram call in DO CONCURRENT is not PURE - p (problem.f90: 7)
! 0 inform, 0 warnings, 1 severes, 0 fatal for problem

program pureProcedurePointerProblem
procedure(positive),pointer :: p

do n=0,1; print *,p(n); enddo ! no problem
do concurrent (n=0:1); print *,positive(n); enddo ! no problem
do concurrent (n=0:1); print *,p(n); enddo ! problem


pure logical function positive(n)
integer,intent(in) :: n
end function

end program

Hi lahan,

While we don’t support procedure pointers in device code yet, I’m not sure this is related or not. I’ll need engineering to take a look so added a problem report, TPR #31404.


Hi lahan,

Engineering was able to fix this issue in the 22.3 release. As I noted before, procedure pointers are not supported in device code, but so long as do concurrent is targeting multi-core CPUs, the code should work now correctly.


Hi Mat,
that was fast. Thanks.