diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-04-05 14:00:27 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-04-05 14:00:27 +0000 |
commit | 060fca4a44e24baebe7575b9119518b7821c1c45 (patch) | |
tree | df13ebdde93460ad65add194cc1c5525e7975da8 /gcc/fortran/decl.c | |
parent | 7706ca5daabf10746160ca86f93fb97c77017863 (diff) | |
download | gcc-060fca4a44e24baebe7575b9119518b7821c1c45.zip gcc-060fca4a44e24baebe7575b9119518b7821c1c45.tar.gz gcc-060fca4a44e24baebe7575b9119518b7821c1c45.tar.bz2 |
re PR fortran/31292 (ICE with module procedure interface in a procedure body)
2007-04-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31292
* decl.c (gfc_match_modproc): Go up to the top of the namespace
tree to find the module namespace for gfc_get_symbol.
2007-04-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31292
* gfortran.dg/contained_module_proc_1.f90: New test.
From-SVN: r123517
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 570a036..c9383cc 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -4241,6 +4241,7 @@ gfc_match_modproc (void) char name[GFC_MAX_SYMBOL_LEN + 1]; gfc_symbol *sym; match m; + gfc_namespace *module_ns; if (gfc_state_stack->state != COMP_INTERFACE || gfc_state_stack->previous == NULL @@ -4251,6 +4252,14 @@ gfc_match_modproc (void) return MATCH_ERROR; } + module_ns = gfc_current_ns->parent; + for (; module_ns; module_ns = module_ns->parent) + if (module_ns->proc_name->attr.flavor == FL_MODULE) + break; + + if (module_ns == NULL) + return MATCH_ERROR; + for (;;) { m = gfc_match_name (name); @@ -4259,7 +4268,7 @@ gfc_match_modproc (void) if (m != MATCH_YES) return MATCH_ERROR; - if (gfc_get_symbol (name, gfc_current_ns->parent, &sym)) + if (gfc_get_symbol (name, module_ns, &sym)) return MATCH_ERROR; if (sym->attr.proc != PROC_MODULE |