[J3] Self-assignment of allocatable component
Daniel C Chen
cdchen at ca.ibm.com
Mon Jul 26 20:16:59 UTC 2021
Hi Vipul,
My understanding is that the paragraph you quoted is AFTER (1), deallocate
LHS component, and (2), allocate LHS component based on RHS. Because Step
(1) already makes the RHS component unallocated, the rest actions are void.
Thanks,
Daniel Chen
XL Fortran Development, Fortran Standard Representative
IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
From: "Vipul Parekh via J3" <j3 at mailman.j3-fortran.org>
To: "General J3 interest list" <j3 at mailman.j3-fortran.org>
Cc: "Vipul Parekh" <parekhvs at gmail.com>
Date: 2021-07-26 04:10 PM
Subject: [EXTERNAL] Re: [J3] Self-assignment of allocatable component
Sent by: "J3" <j3-bounces at mailman.j3-fortran.org>
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
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/039ea565/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210726/039ea565/attachment-0001.gif>
More information about the J3
mailing list