[EXTERNAL] [Fortran] PR37336 - FIINAL patch [1/n]: Implement the finalization wrapper subroutine
Tobias Burnus
burnus@net-b.de
Tue Aug 14 05:55:00 GMT 2012
Hi Damian, dear all,
Rouson, Damian wrote:
> Thanks for your work on this. This is a big step. I would add to your
> list the following:
>
> (4) If the entity is of extended type and the parent type has a component
> that is finalizable, the parent component's component is finalized.
I believe that's already covered by (3) which invokes (1) for the parent
type – and handles the parent's components via (2). (Besides, in the
standard is not much more than (1)–(3); thus, if it weren't implied by
those, it likely wouldn't be part of the standard at all.)
> In ForTrilnos, we need for this to happen even when the parent is abstract
> but has a finalizable component.
I think that's (mostly) handled via the current wrapper subroutine (i.e.
the finalizer of an allocatable component, which has been added in an
abstract type, is finalized).
However, I think there are two issues with the current patch:
(a) If an abstract type has itself finalizer, it is currently not
called. (Only its components are finalized)
(b) The current patch doesn't finalize nonallocatable [nonpointer]
components, but those might also have a finalizer.
Thanks for your comments.
Tobias
> On 8/13/12 1:05 PM, "Tobias Burnus" <burnus@net-b.de> wrote:
>> The finalization is done as follows (F2008, "4.5.6.2 The finalization
>> process")
>>
>> "(1) If the dynamic type of the entity has a final subroutine whose
>> dummy argument has the same kind type parameters and rank as the entity
>> being finalized, it is called with the entity as an actual argument.
>> Otherwise, if there is an elemental final subroutine whose dummy
>> argument has the same kind type parameters as the entity being
>> finalized, it is called with the entity as an actual argument.
>> Otherwise, no subroutine is called at this point.
>>
>> "(2) All finalizable components that appear in the type definition are
>> finalized in a processor-dependent order. If the entity being finalized
>> is an array, each finalizable component of each element of that entity
>> is finalized separately.
>>
>> "(3) If the entity is of extended type and the parent type is
>> finalizable, the parent component is finalized."
More information about the Fortran
mailing list