[J3] [EXTERNAL] Re: Clarification on F18/017
Malcolm Cohen
malcolm at nag-j.co.jp
Thu Jun 11 21:35:56 EDT 2020
Hi folks,
Some probably-final comments from me on this topic
There is no doubt in my mind that finalization was not intended to, and does not cause deallocation (evidence: the standard does not say that it does).
There is equally no doubt in my mind that deallocation of allocatable and pointer entities was intended to, and does cause finalization (evidence: the standard says that).
There is similarly no doubt in my mind that allocatable components were not intended to be finalized as part of the containing object finalization, but as part of the automatic deallocation process (evidence: the definition of finalizable in the standard ignores allocatable components).
Thus I think the interp should remain as it is now.
Interestingly, of the four compilers that I have access to and which support FINAL, two out of the four produce CBPA for Ondrej’s example, and two produce CABP. Changing the A component to “CLASS(*)” and the allocation to allocate it as type OBJECTA, the two CBPA-producing compilers remain producing CBPA (as one might expect if they’re following the deallocation-causes-finalization model), but one of the other two now produces CBP which is clearly erroneous.
I am not necessarily opposed in principle to the idea of changing finalization to cause deallocation of allocatable components, though it seems to me that the user already has the tools available to force an ordering when he wants to, so I am yet to be convinced of its usefulness. I do however, think this would be a significant change to the design (virtually a new feature), and so should be considered (should we decide that it is in fact desirable) in a future revision.
Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20200612/32a7c949/attachment.htm>
More information about the J3
mailing list