https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100273

--- Comment #9 from anlauf at gcc dot gnu.org ---
Patch that fixes the ICE:

diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index 6692ac7ef4c..ee41d66e6d2 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -5540,7 +5540,8 @@ gfc_create_module_variable (gfc_symbol * sym)
   /* Create the variable.  */
   pushdecl (decl);
   gcc_assert (sym->ns->proc_name->attr.flavor == FL_MODULE
-             || (sym->ns->parent->proc_name->attr.flavor == FL_MODULE
+             || ((sym->ns->parent->proc_name->attr.flavor == FL_MODULE
+                  || sym->ns->parent->proc_name->attr.flavor == FL_PROCEDURE)
                  && sym->fn_result_spec));
   DECL_CONTEXT (decl) = sym->ns->proc_name->backend_decl;
   rest_of_decl_compilation (decl, 1, 0);

Reply via email to