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

p=>positive
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

contains

pure logical function positive(n)
integer,intent(in) :: n
positive=n>0
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.

-Mat

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.

-Mat

Hi Mat,
that was fast. Thanks.
L.