(Class-) array finalization and initialization question

Andre Vehreschild vehre@gmx.de
Fri Feb 20 13:23:00 GMT 2015


Hi Tobias,

<<< snipp >>> 
> Hence, the procedure cannot be PURE - or the dummy argument not 
> polymorphic. If one has a nonpolymorphic dummy argument, one can check 
> the pureness of the finalizer at compile time. (Do we actually do this?)

I played around a bit with the pure/polymorphic thingy (see attached program).
I hope I did it right. When I get it right, then a variable is not polymorphic,
when it is declared TYPE(...). I did this for the elemental subroutine
type_init(). I think the routine is implicitly pure (F2008 12.8.1 §2 2nd
sentence). Nevertheless is it not flagged that the impure finalizer is called.
See dump-tree-original and output, where after calling type_init() the fin_cnt
== 6, expressing that the impure elemental finalizer has been called for all
six elements selected by the strides in the call to type_init(). 

I think the answer to your question tends to be: no, or at least when it is
discovered it is neither flagged (nor made use of). 

Another issue, that pops into the eye, is that the initializer is not applied
for non-polymorphic types, only the finalizer, when calling type_init(). This
is supported by the pseudo-code where no call to copying the __def_init-value
is generated. The question here is, what to expect?  

> I think the issue came up once at the J3 mailing list.
> 
> In words of the standard (F2015 draft):
> 
> C1289 An INTENT (OUT) dummy argument of a pure procedure shall not be 
> such that finalization of the
> actual argument would reference an impure procedure.

This seems to be violated currently, but we haven't yet implemented F2015,
right?

> C1290 An INTENT (OUT) dummy argument of a pure procedure shall not be 
> polymorphic.

Check! This is already enforced, independent of the pureness of the finalizer.

I hope this analysis helps. Ideas? Questions?

- Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: static_pure_test.f08
Type: application/octet-stream
Size: 1219 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150220/c7c21a89/attachment.obj>


More information about the Fortran mailing list