diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-08-04 20:46:11 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-08-04 20:46:11 +0000 |
commit | aa84a9a5e414aad8acbbdf4efae1f951bc9a1de7 (patch) | |
tree | df679370a76da565ff23a0cbbdd8f61a1c342b7f /gcc/fortran/decl.c | |
parent | 6b44ad312f943d9ae65ad6db8f4be0640eefec6e (diff) | |
download | gcc-aa84a9a5e414aad8acbbdf4efae1f951bc9a1de7.zip gcc-aa84a9a5e414aad8acbbdf4efae1f951bc9a1de7.tar.gz gcc-aa84a9a5e414aad8acbbdf4efae1f951bc9a1de7.tar.bz2 |
re PR fortran/31214 (User-defined operator using entry leads to ICE)
2007-08-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31214
* symbol.c (get_unique_symtree): Moved from module.c.
* module.c (get_unique_symtree): Moved to symbol.c.
* decl.c (get_proc_name): Transfer the typespec from the local
symbol to the module symbol, in the case that an entry is also
a module procedure. Ensure the local symbol is cleaned up by
pointing to it with a unique symtree.
* dump_parse_tree (gfc_show_code_node): Add EXEC_ASSIGN_CALL.
2007-08-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31214
* gfortran.dg/entry_13.f90: New test.
* gfortran.dg/entry_12.f90: Clean up .mod file.
From-SVN: r127213
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index a94085f..d674aeb 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -681,8 +681,27 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry) { /* 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 if (gfc_get_symbol (name, NULL, &sym) == 0 + && sym + && sym->ts.type != BT_UNKNOWN + && (*result)->ts.type == BT_UNKNOWN + && sym->attr.flavor == FL_UNKNOWN) + /* Pick up the typespec for the entry, if declared in the function + body. Note that this symbol is FL_UNKNOWN because it will + only have appeared in a type declaration. The local symtree + is set to point to the module symbol and a unique symtree + to the local version. This latter ensures a correct clearing + of the symbols. */ + { + (*result)->ts = sym->ts; + gfc_find_sym_tree (name, gfc_current_ns, 0, &st); + st->n.sym = *result; + st = gfc_get_unique_symtree (gfc_current_ns); + st->n.sym = sym; + } } else rc = gfc_get_symbol (name, gfc_current_ns->parent, result); |