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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
   Last reconfirmed|                            |2021-07-06
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 45c3ad387ac..897cfde3ed3 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -15307,6 +15308,15 @@ resolve_symbol (gfc_symbol *sym)
     return;
   sym->resolve_symbol_called = 1;

+  /* Symbol cannot have an external attribute and be a contained procedure. 
*/
+  if (sym->attr.external && sym->attr.contained)
+    {
+      gfc_error ("Contained procedure %qs at %L conflicts with "
+                "a previously declared EXTERNAL procedure",
+                sym->name, &sym->declared_at);
+      return;
+    }
+
   /* No symbol will ever have union type; only components can be unions.
      Union type declaration symbols have type BT_UNKNOWN but flavor FL_UNION
      (just like derived type declaration symbols have flavor FL_DERIVED). */

Reply via email to