------- Comment #1 from jaydub66 at gmail dot com  2008-05-25 14:02 -------
Here is a first patch:

Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c        (revision 135859)
+++ gcc/fortran/symbol.c        (working copy)
@@ -439,7 +439,7 @@ check_conflict (symbol_attribute *attr, 
   conf (external, intrinsic);
   conf (entry, intrinsic);

-  if ((attr->if_source && !attr->procedure) || attr->contained)
+  if ((attr->if_source == IFSRC_DECL && !attr->procedure) || attr->contained)
     {
       conf (external, subroutine);
       conf (external, function);
Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c (revision 135859)
+++ gcc/fortran/parse.c (working copy)
@@ -1917,12 +1917,26 @@ loop:
       new_state = COMP_SUBROUTINE;
       gfc_add_explicit_interface (gfc_new_block, IFSRC_IFBODY,
                                  gfc_new_block->formal, NULL);
+      if (current_interface.type != INTERFACE_ABSTRACT &&
+        gfc_add_external (&gfc_new_block->attr, &gfc_current_locus) ==
FAILURE)
+       {
+         reject_statement ();
+         gfc_free_namespace (gfc_current_ns);
+         goto loop;
+       }
       break;

     case ST_FUNCTION:
       new_state = COMP_FUNCTION;
       gfc_add_explicit_interface (gfc_new_block, IFSRC_IFBODY,
                                  gfc_new_block->formal, NULL);
+      if (current_interface.type != INTERFACE_ABSTRACT &&
+        gfc_add_external (&gfc_new_block->attr, &gfc_current_locus) ==
FAILURE)
+       {
+         reject_statement ();
+         gfc_free_namespace (gfc_current_ns);
+         goto loop;
+       }
       break;

     case ST_PROCEDURE:


This removes the conflict between EXTERNAL and SUBROUTINE for this case, and
adds the EXTERNAL attribute for a non-abstract INTERFACE statement.

Checking for regressions ...


-- 


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

Reply via email to