https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127683
--- Comment #5 from Harald Anlauf <anlauf at gcc dot gnu.org> ---
This obvious patch fixes it:
diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
index f4536cb2fa9..0416a7be618 100644
--- a/gcc/fortran/symbol.cc
+++ b/gcc/fortran/symbol.cc
@@ -2525,7 +2525,8 @@ gfc_find_derived_types (gfc_symbol *sym, gfc_namespace
*ns,
const char *name, bool stash)
{
gfc_namespace *encompassing = NULL;
- gcc_assert (sym->assoc);
+ if (sym->assoc == NULL)
+ return 0;
cts = 0;
while (ns->parent)