re PR fortran/65453 (ICE in build_function_decl, at fortran/trans-decl.c:2001)
[gcc.git] / gcc / fortran / decl.c
index 104752586b4ebc0791d93abe20a2df2abcc0398b..9ffaa78e587134691632ffd3b72823a1e3daf578 100644 (file)
@@ -1219,6 +1219,12 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
        gfc_error_now ("Procedure %qs at %C is already defined at %L",
                       name, &sym->declared_at);
 
+      if (sym->attr.external && sym->attr.procedure
+         && gfc_current_state () == COMP_CONTAINS)
+       gfc_error_now ("Contained procedure %qs at %C clashes with "
+                       "procedure defined at %L",
+                      name, &sym->declared_at);
+
       /* Trap a procedure with a name the same as interface in the
         encompassing scope.  */
       if (sym->attr.generic != 0