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

--- Comment #1 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
ndex: decl.c
===================================================================
--- decl.c      (revision 270181)
+++ decl.c      (working copy)
@@ -7598,6 +7598,13 @@ gfc_match_subroutine (void)
   if (m != MATCH_YES)
     return m;

+  if (current_attr.module_procedure == 1
+      && gfc_current_state () != COMP_MODULE)
+    {
+      gfc_error ("MODULE SUBROUTINE found outside of a module at %C");
+      return MATCH_ERROR;
+    }
+
   if (get_proc_name (name, &sym, false))
     return MATCH_ERROR;

Reply via email to