https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82064
--- Comment #7 from janus at gcc dot gnu.org --- (In reply to Paul Thomas from comment #4) > The permanent fix is to make sure that the vtables get produced > unconditionally for module derived types. This is accomplished by the following patch ... Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (revision 253282) +++ gcc/fortran/decl.c (working copy) @@ -9881,6 +9881,9 @@ gfc_match_derived_decl (void) /* Take over the ABSTRACT attribute. */ sym->attr.abstract = attr.abstract; + if (gfc_current_state () == COMP_MODULE) + gfc_find_derived_vtab (sym); + gfc_new_block = sym; return MATCH_YES; ... which indeed fixes the issue with 'test_sep'. (Note: I have not regtested it yet, but I hope it will not break anything.)