https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80361
--- Comment #16 from janus at gcc dot gnu.org --- This seems to be sufficient to fix the runtime error on the reduced test case in comment #13: Index: gcc/fortran/class.c =================================================================== --- gcc/fortran/class.c (revision 246822) +++ gcc/fortran/class.c (working copy) @@ -1613,6 +1613,7 @@ generate_finalization_wrapper (gfc_symbol *derived final->attr.flavor = FL_PROCEDURE; final->attr.function = 1; final->attr.pure = 0; + final->attr.recursive = 1; final->result = final; final->ts.type = BT_INTEGER; final->ts.kind = 4;