From 1a492601a1e4a1e5e16a2de9c10065ce062394e4 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Fri, 9 Jun 2006 22:16:08 +0000 Subject: re PR fortran/24558 (ENTRY doesn't work in module procedures) 2006-06-10 Paul Thomas PR fortran/24558 PR fortran/20877 PR fortran/25047 * decl.c (get_proc_name): Add new argument to flag that a module function entry is being treated. If true, correct error condition, add symtree to module namespace and add a module procedure. (gfc_match_function_decl, gfc_match_entry, gfc_match_subroutine): Use the new argument in calls to get_proc_name. * resolve.c (resolve_entries): ENTRY symbol reference to to master entry namespace if a module function. * trans-decl.c (gfc_create_module_variable): Return if the symbol is an entry. * trans-exp.c (gfc_conv_variable): Check that parent_decl is not NULL. 2006-06-10 Paul Thomas PR fortran/24558 * gfortran.dg/entry_6.f90: New test. PR fortran/20877 PR fortran/25047 * gfortran.dg/entry_7.f90: New test. From-SVN: r114526 --- gcc/fortran/resolve.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gcc/fortran/resolve.c') diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 33e21df..384b5a4 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -385,6 +385,16 @@ resolve_entries (gfc_namespace * ns) ns->entries = el; ns->proc_name->attr.entry = 1; + /* If it is a module function, it needs to be in the right namespace + so that gfc_get_fake_result_decl can gather up the results. The + need for this arose in get_proc_name, where these beasts were + left in their own namespace, to keep prior references linked to + the entry declaration.*/ + if (ns->proc_name->attr.function + && ns->parent + && ns->parent->proc_name->attr.flavor == FL_MODULE) + el->sym->ns = ns; + /* Add an entry statement for it. */ c = gfc_get_code (); c->op = EXEC_ENTRY; -- cgit v1.1