[J3] [EXTERNAL] [BULK] Re: Question on dummy CLASS(*) pointer arguments
Clune, Thomas L. (GSFC-6101)
thomas.l.clune at nasa.gov
Wed Nov 29 18:07:08 UTC 2023
Brad,
OK – I’ll think about that, but I don’t immediately see how to change the dynamic type of the target in this case. Indeed, hard to see how that would not be changing the association …
* Tom
From: J3 <j3-bounces at mailman.j3-fortran.org> on behalf of j3 <j3 at mailman.j3-fortran.org>
Reply-To: j3 <j3 at mailman.j3-fortran.org>
Date: Wednesday, November 29, 2023 at 1:02 PM
To: j3 <j3 at mailman.j3-fortran.org>
Cc: Brad Richardson <everythingfunctional at protonmail.com>
Subject: [EXTERNAL] [BULK] Re: [J3] Question on dummy CLASS(*) pointer arguments
CAUTION: This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC.
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/9c54beb2/attachment-0001.htm>
More information about the J3
mailing list