[Bug fortran/31292] ICE with module procedure interface in a procedure body

kargl at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Aug 28 21:21:00 GMT 2009



------- Comment #5 from kargl at gcc dot gnu dot org  2009-08-28 21:21 -------
The committed to fix the bug is too aggressive.  An interface block
with a module procedure statement can appear in a PROGRAM unit
and any subprogram.  I have a patch the relaxes the check and 
allows the newly attached program to compile and run.

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (revision 151144)
+++ gcc/fortran/decl.c  (working copy)
@@ -6481,7 +6481,10 @@ gfc_match_modproc (void)

   module_ns = gfc_current_ns->parent;
   for (; module_ns; module_ns = module_ns->parent)
-    if (module_ns->proc_name->attr.flavor == FL_MODULE)
+    if (module_ns->proc_name->attr.flavor == FL_MODULE
+       || module_ns->proc_name->attr.flavor == FL_PROGRAM
+       || (module_ns->proc_name->attr.flavor == FL_PROCEDURE
+           && !module_ns->proc_name->attr.contained))
       break;

   if (module_ns == NULL)


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31292



More information about the Gcc-bugs mailing list