diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-05-11 06:19:57 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-05-11 06:19:57 +0000 |
commit | 6c12686bc785194a7e9a7909cfb951e34c9d7355 (patch) | |
tree | 3fc6b79689fc2c56a85ab8d04947e4fd1fb9f782 /gcc/fortran | |
parent | 1b716e906bb86e68c79b3ff73c9786f3aff52dc7 (diff) | |
download | gcc-6c12686bc785194a7e9a7909cfb951e34c9d7355.zip gcc-6c12686bc785194a7e9a7909cfb951e34c9d7355.tar.gz gcc-6c12686bc785194a7e9a7909cfb951e34c9d7355.tar.bz2 |
re PR fortran/31474 (ENTRY & procedural pointer: insert_bbt(): Duplicate key found!)
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.
From-SVN: r124613
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 23 |
2 files changed, 24 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3613745..342864b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +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-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/31630 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 0071f90..9eeacc0 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; |