[J3] Self-assignment of allocatable component
Vipul Parekh
parekhvs at gmail.com
Mon Jul 26 20:09:58 UTC 2021
On Mon, Jul 26, 2021 at 3:17 PM Daniel C Chen via J3 <
j3 at mailman.j3-fortran.org> wrote:
> ..
> Apprently p%i is unallocated after the self-assignment. Is this code still
> standard conforming?
>
Hi Daniel,
Interesting question! 3 different compilers I have access to indicate
"p%i" is indeed allocated after the "self-assignment"!
I look forward to the discussion. Paragraph 1 in section 10.2.1.3
Interpretation of intrinsic assignments [p170:11-16] reads as the
assignment you show can be interpreted *as though* it were *equivalent* to:
block
type(dt) :: tmp
tmp = p
p = tmp
end block
thereby leaving "p%i" as allocated and which is what the 3 processors I
tried appeared to be doing.
Regards,
Vipul Parekh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210726/31030c94/attachment.htm>
More information about the J3
mailing list