diff options
author | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-20 13:48:06 +0000 |
---|---|---|
committer | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-20 13:48:06 +0000 |
commit | 3186f695660bb621c576ff78e8851517799b697f (patch) | |
tree | 006a73693cd6f5f41909b3e2d5aff9801697221d /gcc/fortran | |
parent | a30b29a7777cc383807116c38f3d172b7678d950 (diff) | |
download | gcc-3186f695660bb621c576ff78e8851517799b697f.tar.gz |
2006-12-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29992
* interface.c (check_sym_interfaces): Module procedures in a
generic must be use associated or contained in the module.
* decl.c (gfc_match_modproc): Set attribute mod_proc.
* gfortran.h (symbol_attribute): Add mod_proc atribute.
PR fortran/30081
* resolve.c (resolve_generic_f, resolve_generic_s): Use
gfc_intrinsic_name to find out if the function is intrinsic
because it does not have to be a generic intrinsic to be
overloaded.
2006-12-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29992
* gfortran.dg/generic_9.f90: New test.
PR fortran/30081
* gfortran.dg/generic_10.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120072 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 2 | ||||
-rw-r--r-- | gcc/fortran/gfortran.h | 2 | ||||
-rw-r--r-- | gcc/fortran/interface.c | 13 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 12 |
5 files changed, 37 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ee984b19a7a..d283671cb0c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,17 @@ +2006-12-20 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/29992 + * interface.c (check_sym_interfaces): Module procedures in a + generic must be use associated or contained in the module. + * decl.c (gfc_match_modproc): Set attribute mod_proc. + * gfortran.h (symbol_attribute): Add mod_proc atribute. + + PR fortran/30081 + * resolve.c (resolve_generic_f, resolve_generic_s): Use + gfc_intrinsic_name to find out if the function is intrinsic + because it does not have to be a generic intrinsic to be + overloaded. + 2006-12-19 Tobias Burnus <burnus@net-b.de> PR fortran/39238 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index eb3323733ee..d8988fd2015 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -4289,6 +4289,8 @@ gfc_match_modproc (void) if (gfc_add_interface (sym) == FAILURE) return MATCH_ERROR; + sym->attr.mod_proc = 1; + if (gfc_match_eos () == MATCH_YES) break; if (gfc_match_char (',') != MATCH_YES) diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 0c67d10cf7e..296004edbc8 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -494,7 +494,7 @@ typedef struct /* Function/subroutine attributes */ unsigned sequence:1, elemental:1, pure:1, recursive:1; - unsigned unmaskable:1, masked:1, contained:1; + unsigned unmaskable:1, masked:1, contained:1, mod_proc:1; /* This is set if the subroutine doesn't return. Currently, this is only possible for intrinsic subroutines. */ diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 611754ccbd9..6ffa4b2e982 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1011,6 +1011,7 @@ check_sym_interfaces (gfc_symbol * sym) { char interface_name[100]; bool k; + gfc_interface *p; if (sym->ns != gfc_current_ns) return; @@ -1021,6 +1022,18 @@ check_sym_interfaces (gfc_symbol * sym) if (check_interface0 (sym->generic, interface_name)) return; + for (p = sym->generic; p; p = p->next) + { + if (!p->sym->attr.use_assoc + && p->sym->attr.mod_proc + && p->sym->attr.if_source != IFSRC_DECL) + { + gfc_error ("MODULE PROCEDURE '%s' at %L does not come " + "from a module", p->sym->name, &p->where); + return; + } + } + /* Originally, this test was aplied to host interfaces too; this is incorrect since host associated symbols, from any source, cannot be ambiguous with local symbols. */ diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 33ef7481470..519d92ab9b7 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1215,9 +1215,9 @@ generic: goto generic; } - /* Last ditch attempt. */ - - if (!gfc_generic_intrinsic (expr->symtree->n.sym->name)) + /* Last ditch attempt. See if the reference is to an intrinsic + that possesses a matching interface. 14.1.2.4 */ + if (!gfc_intrinsic_name (sym->name, 0)) { gfc_error ("There is no specific function for the generic '%s' at %L", expr->symtree->n.sym->name, &expr->where); @@ -1675,9 +1675,11 @@ generic: goto generic; } - /* Last ditch attempt. */ + /* Last ditch attempt. See if the reference is to an intrinsic + that possesses a matching interface. 14.1.2.4 */ sym = c->symtree->n.sym; - if (!gfc_generic_intrinsic (sym->name)) + + if (!gfc_intrinsic_name (sym->name, 1)) { gfc_error ("There is no specific subroutine for the generic '%s' at %L", |