[J3] Question on dummy CLASS(*) pointer arguments

Clune, Thomas L. (GSFC-6101) thomas.l.clune at nasa.gov
Wed Nov 29 17:45:25 UTC 2023


Consider the code below:

program main
   implicit none
   real, pointer :: y(:)

   allocate(y(2))
   call s(y)

contains

   subroutine s(x)
      class(*), pointer, intent(in) :: x(:)
   end subroutine s

end program main

This is disallowed by the standard, presumably because the pointer array x could become associated with some other type.   However, since the dummy pointer has the INTENT(IN) attribute, I do not immediately see what could go wrong.   Is it simply that processors may want to have different representations for POINTER objects that we don’t want to force the conversion here?

Thanks,


  *   Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20231129/070693bc/attachment.htm>


More information about the J3 mailing list