https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65347
Bug ID: 65347 Summary: Final subroutine are not called Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: eddyg_61-bugzilla at yahoo dot it In the following program the final subroutine are not called module testfin_mod implicit none type tfin integer :: t = -1 contains final :: del_tfin final :: del_tfinv end type contains function Ctfin(s) result(this) integer,intent(in) :: s type(tfin) :: this this % t = s end function subroutine del_tfin(this) type(tfin), intent(inout) :: this print *,"Finalized", this % t end subroutine subroutine del_tfinv(this) type(tfin), intent(inout) :: this(:) print *,"Finalized vector", this % t end subroutine subroutine printsomev(a) type(tfin) :: a(:) print *,'PRV:', a end subroutine subroutine printsomes(a) type(tfin) :: a print *,'PRS:', a%t end subroutine subroutine pluto type(tfin),save :: a(3) call printsomev([a(2), a(1), a(3)]) call printsomev([a(2), Ctfin(10), a(3)]) call printsomes(Ctfin(11)) end subroutine end module program test1 use testfin_mod implicit none call pluto end program The standard (as far as I know) requires the temporary variables corresponding to Ctfin(10) and Ctfin(11) to be finalized after the end of the subroutines printsomev and printsomev. But no finalization take places. The compiler ifort 13.0.1 correctly calls the final procedures.