[J3] Question on dummy CLASS(*) pointer arguments
Brad Richardson
everythingfunctional at protonmail.com
Wed Nov 29 18:01:52 UTC 2023
It's disallowed because the `intent(in)` only applies to the association status with the pointer attribute. I.e. it doesn't say you're not allowed to assign to the target, and assigning to the target could change the dynamic type. At least I think that covers the main reason. There's lots of other nuances that could come into play in certain cases.
Regards,
Brad
On Wed, 2023-11-29 at 17:45 +0000, Clune, Thomas L. \(GSFC-6101\) via J3 wrote:
> 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/1c247e89/attachment-0001.htm>
More information about the J3
mailing list