Hi Mikael, thanks for your suggestions and the approval of the patch.
>> maybe add gcc_assert to >> make it clear that fini->proc_tree should be set at this point. > Or better: a comment ;-) I'm going for the gcc_assert *plus* a comment ;) The thusly updated patch in the attachment regtests cleanly. Will commit later today. Cheers, Janus
Index: gcc/fortran/class.c =================================================================== --- gcc/fortran/class.c (revision 207631) +++ gcc/fortran/class.c (working copy) @@ -1880,8 +1880,7 @@ generate_finalization_wrapper (gfc_symbol *derived for (fini = derived->f2k_derived->finalizers; fini; fini = fini->next) { - if (!fini->proc_tree) - fini->proc_tree = gfc_find_sym_in_symtree (fini->proc_sym); + gcc_assert (fini->proc_tree); /* Should have been set in gfc_resolve_finalizers. */ if (fini->proc_tree->n.sym->attr.elemental) { fini_elem = fini; Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 207631) +++ gcc/fortran/resolve.c (working copy) @@ -12455,10 +12455,6 @@ resolve_fl_derived0 (gfc_symbol *sym) /* Add derived type to the derived type list. */ add_dt_to_dt_list (sym); - /* Check if the type is finalizable. This is done in order to ensure that the - finalization wrapper is generated early enough. */ - gfc_is_finalizable (sym, NULL); - return true; }