[J3] LOCAL and LOCAL_INIT with procedure pointers

Tobias Burnus burnus at net-b.de
Sat Mar 9 14:49:34 UTC 2024


Hi all,

I was wondering whether the following is valid (probably not)
and whether it should(*) be.

[(*) It seems as if LOCAL[_INIT] for procedure pointer can be useful
and seems to be sensible, albeit it does not seem to be a common
usage pattern.]

! ---------------
interface
   pure integer function one(x)
     integer, value :: x
   end
   pure integer function two(x)
     integer, value :: x
   end
end interface

integer :: i, A(10)
procedure(one), pointer :: f
A = 0
do concurrent (i = 1: 10) local(f)
   if (mod (i, 2) == 0) then
     f => one
   else
     f => two
   end if
   A(i) = f(1 + (i-1)/2)
end do
end
! ---------------


Tobias




More information about the J3 mailing list