summaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-11 06:19:57 +0000
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-11 06:19:57 +0000
commit861d824f401fc0bde4240beded58ea8ca98bdda7 (patch)
tree3fc6b79689fc2c56a85ab8d04947e4fd1fb9f782 /gcc/fortran/decl.c
parent1f3fc4aab7cc3de3b093d75a00b4162c8befeb36 (diff)
downloadgcc-861d824f401fc0bde4240beded58ea8ca98bdda7.tar.gz
2007-05-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31474 * decl.c (get_proc_name): If an entry has already been declared as a module procedure, pick up the symbol and the symtree and use them for the entry. 2007-05-11 Paul Thomas <pault@gcc.gnu.org> PR fortran/31474 * gfortran.dg/entry_10.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124613 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 0071f905611..9eeacc09427 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -671,7 +671,12 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
space is set to point to the master function, so that the fake
result mechanism can work. */
if (module_fcn_entry)
- rc = gfc_get_symbol (name, NULL, result);
+ {
+ /* Present if entry is declared to be a module procedure. */
+ rc = gfc_find_symbol (name, gfc_current_ns->parent, 0, result);
+ if (*result == NULL)
+ rc = gfc_get_symbol (name, NULL, result);
+ }
else
rc = gfc_get_symbol (name, gfc_current_ns->parent, result);
@@ -712,7 +717,12 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
/* Module function entries will already have a symtree in
the current namespace but will need one at module level. */
if (module_fcn_entry)
- st = gfc_new_symtree (&gfc_current_ns->parent->sym_root, name);
+ {
+ /* Present if entry is declared to be a module procedure. */
+ rc = gfc_find_sym_tree (name, gfc_current_ns->parent, 0, &st);
+ if (st == NULL)
+ st = gfc_new_symtree (&gfc_current_ns->parent->sym_root, name);
+ }
else
st = gfc_new_symtree (&gfc_current_ns->sym_root, name);
@@ -722,10 +732,11 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
/* See if the procedure should be a module procedure */
if (((sym->ns->proc_name != NULL
- && sym->ns->proc_name->attr.flavor == FL_MODULE
- && sym->attr.proc != PROC_MODULE) || module_fcn_entry)
- && gfc_add_procedure (&sym->attr, PROC_MODULE,
- sym->name, NULL) == FAILURE)
+ && sym->ns->proc_name->attr.flavor == FL_MODULE
+ && sym->attr.proc != PROC_MODULE)
+ || (module_fcn_entry && sym->attr.proc != PROC_MODULE))
+ && gfc_add_procedure (&sym->attr, PROC_MODULE,
+ sym->name, NULL) == FAILURE)
rc = 2;
return rc;