https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108925
--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> ---
This does NOT improve things:
diff --git a/gcc/fortran/module.cc b/gcc/fortran/module.cc
index 601497e0998..2d6c7b8ef73 100644
--- a/gcc/fortran/module.cc
+++ b/gcc/fortran/module.cc
@@ -5258,7 +5258,10 @@ read_cleanup (pointer_info *p)
vtypes - their name is fine for a symtree and reduces the
namespace pollution. */
st = gfc_find_symtree (ns->sym_root, p->u.rsym.sym->name);
- if (!st)
+ if (st)
+ /* The symtree is reassigned below. */
+ st->n.sym->refs--;
+ else
st = gfc_new_symtree (&ns->sym_root, p->u.rsym.sym->name);
}