[Bug fortran/37336] Fortran 2003: Finish derived-type finalization

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Oct 26 16:47:00 GMT 2012


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.



More information about the Gcc-bugs mailing list