This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: *PING* / Re: [Patch, Fortran] Finalize nonallocatables with INTENT(out)
- From: Tobias Burnus <burnus at net-b dot de>
- To: Mikael Morin <mikael dot morin at sfr dot fr>
- Cc: fortran at gcc dot gnu dot org, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 08 Jun 2013 14:39:32 +0200
- Subject: Re: *PING* / Re: [Patch, Fortran] Finalize nonallocatables with INTENT(out)
- References: <51A8D22F dot 6040801 at net-b dot de> <51B049CA dot 80202 at net-b dot de> <51B31116 dot 6030202 at sfr dot fr>
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