[Patch, fortran] PR51976 - [F2003] Support deferred-length character components of derived types (allocatable string length)
Tobias Burnus
burnus@net-b.de
Sun Mar 9 19:37:00 GMT 2014
W Spector wrote:
> 3.) My example in comment #12 appears to work fine. However when
> running the example under valgrind, memory leaks are indicated. I cut
> the example down quite a bit, and it seems that there are leaks
> regardless of whether derived types are used or not. So this isn't a
> regression due to this patch, but something that has been around for a
> while:
The problem is that variables in the Fortran main program have the SAVE
attribute - that has been made explicit in the Fortran 2008 standard.
Before finalization, it wasn't detectible by a standard-conforming
Fortran program - but with finalization, it all of a sudden is. Hence,
GCC 4.9 no longer deallocates allocatables in the main program. One
could try to still do the deallocation for nonderived types or for those
without finalizers - but simply not deallocating seems to be way easier
and more consistent.
Note that the 4.9 release notes mention this change.
Tobias
More information about the Fortran
mailing list