https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127210
--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #1)
> It's easy to fix (...)
>
This is what the fix would look like:
diff --git a/gcc/fortran/class.cc b/gcc/fortran/class.cc
index 18cff8f47a1..dd0ba711b9d 100644
--- a/gcc/fortran/class.cc
+++ b/gcc/fortran/class.cc
@@ -947,12 +947,12 @@ add_procs_to_declared_vtab1 (gfc_symtree *st, gfc_symbol
*vtype)
if (st->left)
add_procs_to_declared_vtab1 (st->left, vtype);
- if (st->right)
- add_procs_to_declared_vtab1 (st->right, vtype);
-
if (st->n.tb && !st->n.tb->error
&& !st->n.tb->is_generic && st->n.tb->u.specific)
add_proc_comp (vtype, st->name, st->n.tb);
+
+ if (st->right)
+ add_procs_to_declared_vtab1 (st->right, vtype);
}