*PING* / Re: [Patch, Fortran] Finalize nonallocatables with INTENT(out)

Tobias Burnus burnus@net-b.de
Sat Jun 8 12:40:00 GMT 2013


Hello Mikael,

thanks for your patch reviews! Regarding your question:

Mikael Morin worte:
> Le 06/06/2013 10:35, Tobias Burnus a écrit :
>> On May 31, 2013 18:39, Tobias Burnus wrote:
>>> This patch adds finalization support for INTENT(out) for
>>> nonallocatable dummy arguments.
>>>
>>> Additionally, it addresses a missed optimization: The previous code
>>> tried to deallocate allocatable components even if the dummy argument
>>> was already an allocatable. That's a missed optimization as gfortran
>>> deallocates allocatables in the caller.
>>>
> Is there any reason to handle them in the caller?

I don't think that there is real reason - and I don't know why Erik 
Edelmann and Paul have chosen to do so for GCC 4.2. In principle, either 
location is fine. I think I had placed it into the callee, but now we 
cannot change it anymore without breaking the ABI.

For TS29113 (i.e. for bind(C)), the Fortran procedure has to handle the 
deallocate for allocatable dummys with intent(out). Thus, in that case, 
one needs to have the deallocation code both in the caller and in the 
callee. (TS29113 only permits interoperable types with ALLOCATABLE or 
INTENT(OUT) - noninteroperable vars (i.e. extensible types, allocatable 
components, finalizers etc.) can be used in BIND(C) procedures - but 
only with the dummy argument TYPE(*) - and hence without ALLOCATABLE and 
INTENT(OUT)).

Tobias

PS: Pending patches:
* 4.8/4.9 regression: http://gcc.gnu.org/ml/fortran/2013-06/msg00047.html
* CLASS as result var: http://gcc.gnu.org/ml/fortran/2013-06/msg00053.html



More information about the Fortran mailing list