From 6234cc4e6acae7fa1281205486aca043479680ba Mon Sep 17 00:00:00 2001 From: bstarynk Date: Thu, 9 Jul 2009 19:27:53 +0000 Subject: 2009-07-09 Basile Starynkevitch MELT branch merged with trunk rev 149427 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@149430 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/decl.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'gcc/fortran/decl.c') diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index c3760a81c0b..e2816348643 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -4156,9 +4156,12 @@ static match match_procedure_interface (gfc_symbol **proc_if) { match m; + gfc_symtree *st; locus old_loc, entry_loc; - old_loc = entry_loc = gfc_current_locus; + gfc_namespace *old_ns = gfc_current_ns; + char name[GFC_MAX_SYMBOL_LEN + 1]; + old_loc = entry_loc = gfc_current_locus; gfc_clear_ts (¤t_ts); if (gfc_match (" (") != MATCH_YES) @@ -4177,13 +4180,25 @@ match_procedure_interface (gfc_symbol **proc_if) if (m == MATCH_ERROR) return m; + /* Procedure interface is itself a procedure. */ gfc_current_locus = old_loc; + m = gfc_match_name (name); - /* Get the name of the procedure or abstract interface - to inherit the interface from. */ - m = gfc_match_symbol (proc_if, 1); - if (m != MATCH_YES) - return m; + /* First look to see if it is already accessible in the current + namespace because it is use associated or contained. */ + st = NULL; + if (gfc_find_sym_tree (name, NULL, 0, &st)) + return MATCH_ERROR; + + /* If it is still not found, then try the parent namespace, if it + exists and create the symbol there if it is still not found. */ + if (gfc_current_ns->parent) + gfc_current_ns = gfc_current_ns->parent; + if (st == NULL && gfc_get_ha_sym_tree (name, &st)) + return MATCH_ERROR; + + gfc_current_ns = old_ns; + *proc_if = st->n.sym; /* Various interface checks. */ if (*proc_if) -- cgit v1.2.1