This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Missing Finalizations - was [patch, fortran] Implement simplification of minloc and maxloc
- From: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- To: Thomas Koenig <tkoenig at netcologne dot de>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Tue, 2 Jan 2018 18:11:02 +0000
- Subject: Missing Finalizations - was [patch, fortran] Implement simplification of minloc and maxloc
- Authentication-results: sourceware.org; auth=none
Hi Thomas,
In an email from Tobias in 2014:
*******
Without looking at the PRs, just from recalling:
A = ...
LHS of an assignment is not finalized before the assignment (has to be
done for both allocatable an nonallocatable variables). Exception: If
"A" is not finalizable but has finalizable components, those are
already finalized.
Expressions – those are effectively:
call foo(f())
and
A = f()
where f() returns something finalizable. It probably applies to both
nonpointer, nonallocatable derived types and to allocatable derived
types. For allocatable scalars, we always leak memory.
I think move_alloc is already handled, I don't recall issues with
intrinsics or with intent(out). Thus, I think that's the complete
list.
There is somewhere a PR which shows that the finalization wrapper does
not work properly for nested array derived types. I forgot whether it
ICEs or whether it just doesn't finalize enough.
*******
Cheers
Paul