diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-09 19:27:53 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-09 19:27:53 +0000 |
commit | 6234cc4e6acae7fa1281205486aca043479680ba (patch) | |
tree | 5a82c06ace3a508f8ce6564a35273771ba7e1f4a /gcc/fortran/decl.c | |
parent | 6cefca87057fc5e159a5d47c43ad190fa1a8cb43 (diff) | |
download | gcc-6234cc4e6acae7fa1281205486aca043479680ba.tar.gz |
2009-07-09 Basile Starynkevitch <basile@starynkevitch.net>
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
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 27 |
1 files changed, 21 insertions, 6 deletions
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) |