From 43dfd40c1d5934d5850dcfd2c9a1b9e856bf32a7 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Thu, 10 Sep 2009 21:22:08 +0000 Subject: re PR fortran/31292 (ICE with module procedure interface in a procedure body) 2009-09-10 Steven G. Kargl PR fortran/31292 * fortran/decl.c(gfc_match_modproc): Check that module procedures from a module can USEd in module procedure statements in other program units. Update locus for better error message display. Detect intrinsic procedures in module procedure statements. 2009-09-10 Steven G. Kargl PR fortran/31292 * gfortran.dg/module_procedure_1.f90: New test. * gfortran.dg/module_procedure_2.f90: Ditto. * gfortran.dg/generic_14.f90: Move dg-error to new location. From-SVN: r151616 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/decl.c | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c01c4b3..d134e2c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2009-09-10 Steven G. Kargl + + PR fortran/31292 + * fortran/decl.c(gfc_match_modproc): Check that module procedures + from a module can USEd in module procedure statements in other + program units. Update locus for better error message display. + Detect intrinsic procedures in module procedure statements. + 2009-09-09 Richard Guenther PR fortran/41297 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 52796a6..3ce7fd4 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -6485,7 +6485,10 @@ gfc_match_modproc (void) module_ns = gfc_current_ns->parent; for (; module_ns; module_ns = module_ns->parent) - if (module_ns->proc_name->attr.flavor == FL_MODULE) + if (module_ns->proc_name->attr.flavor == FL_MODULE + || module_ns->proc_name->attr.flavor == FL_PROGRAM + || (module_ns->proc_name->attr.flavor == FL_PROCEDURE + && !module_ns->proc_name->attr.contained)) break; if (module_ns == NULL) @@ -6497,6 +6500,7 @@ gfc_match_modproc (void) for (;;) { + locus old_locus = gfc_current_locus; bool last = false; m = gfc_match_name (name); @@ -6517,6 +6521,13 @@ gfc_match_modproc (void) if (gfc_get_symbol (name, module_ns, &sym)) return MATCH_ERROR; + if (sym->attr.intrinsic) + { + gfc_error ("Intrinsic procedure at %L cannot be a MODULE " + "PROCEDURE", &old_locus); + return MATCH_ERROR; + } + if (sym->attr.proc != PROC_MODULE && gfc_add_procedure (&sym->attr, PROC_MODULE, sym->name, NULL) == FAILURE) @@ -6526,6 +6537,7 @@ gfc_match_modproc (void) return MATCH_ERROR; sym->attr.mod_proc = 1; + sym->declared_at = old_locus; if (last) break; -- cgit v1.1