This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/37336] Fortran 2003: Finish derived-type finalization
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Oct 2012 16:47:08 +0000
- Subject: [Bug fortran/37336] Fortran 2003: Finish derived-type finalization
- Auto-submitted: auto-generated
- References: <bug-37336-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
--- Comment #13 from janus at gcc dot gnu.org 2012-10-26 16:47:08 UTC ---
Latest patch at: http://gcc.gnu.org/ml/fortran/2012-10/msg00126.html
This patch compiles the test case in comment 6 without errors, but the
finalizer is not called.
However, when changing the main program to ...
program main
use child_module
implicit none
class(child),allocatable :: infant
allocate(infant,source=new_child())
end
... the finalizer is called twice: Once at the end of the main program, and
once through the _copy procedure (which is invoked by the ALLOCATE statement),
I think. Not sure if this is the expected behavior.
If the "class(child)" here is changed to "type(child)", no finalization is done
(and in fact not even a finalization routine is generated for the type
'child').
But certainly it should, just as for the original test case in comment 6.