https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64921
--- Comment #14 from Mat Cross <mathewc at nag dot co.uk> --- For the record, perhaps it is of interest for me to note that we are running into this (cf. PR64230 comment 9) on code like Program test Implicit None Type :: t1 Integer, Allocatable :: i End Type Type :: t2 Integer, Allocatable :: i End Type Type, Extends (t1) :: t3 Type (t2) :: j End Type Type, Extends (t3) :: t4 Integer, Allocatable :: k End Type Call s Print *, 'ok' Contains Subroutine s Class (t1), Allocatable :: x Allocate (t4 :: x) End Subroutine End Program Since the crash is in bad compiler-generated finalization code (since 4.9), and given that (if I recall correctly) gfortran is using the Fortran 2008 semantics for entities declared in a main program being implicitly saved, this is why removing the Deallocate (in the comment 12 example) works - the finalizer is never called then. In the interim, does anyone have any bright ideas for a reasonable (few-line) workaround? Thanks.