https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84674
--- Comment #3 from Jakub Benda <albandil at atlas dot cz> --- Bisection points to revision 254427 from 5 November 2017, which adds this chunk of code to "fortran/resolv.c" (function "resolve_fl_derived", lines 14081-14093): /* Generate module vtables subject to their accessibility and their not being vtables or pdt templates. If this is not done class declarations in external procedures wind up with their own version and so SELECT TYPE fails because the vptrs do not have the same address. */ if (gfc_option.allow_std & GFC_STD_F2003 && sym->ns->proc_name && sym->ns->proc_name->attr.flavor == FL_MODULE && sym->attr.access != ACCESS_PRIVATE && !(sym->attr.use_assoc || sym->attr.vtype || sym->attr.pdt_template)) { gfc_symbol *vtab = gfc_find_derived_vtab (sym); gfc_set_sym_referenced (vtab); } When I comment it out, the compiled program works as expected.