aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog18
-rw-r--r--gcc/fortran/gfortran.h1
-rw-r--r--gcc/fortran/interface.c19
-rw-r--r--gcc/fortran/module.c10
-rw-r--r--gcc/fortran/resolve.c13
5 files changed, 39 insertions, 22 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c47a3b8..49db7dc 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,21 @@
+2006-12-27 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/20896
+ * interface.c (check_sym_interfaces): Try to resolve interface
+ reference as a global symbol, if it is not a nodule procedure.
+ (compare_actual_formal): Remove call to gfc_find_symbol; if
+ the expression is already a variable it is locally declared
+ and this has precedence.
+ gfortran.h : Add prototype for resolve_global_procedure.
+ resolve.c (resolve_global_procedure): Remove static attribute
+ from function declaration.
+ (resolve_fl_procedure): Remove symtree declaration and the
+ redundant check for an ambiguous procedure.
+
+ PR fortran/25135
+ * module.c (load_generic_interfaces): If the symbol is present
+ and is not generic it is ambiguous.
+
2006-12-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25818
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 6286297..b477439 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2032,6 +2032,7 @@ void gfc_free_statement (gfc_code *);
void gfc_free_statements (gfc_code *);
/* resolve.c */
+void resolve_global_procedure (gfc_symbol *, locus *, int);
try gfc_resolve_expr (gfc_expr *);
void gfc_resolve (gfc_namespace *);
void gfc_resolve_blocks (gfc_code *, gfc_namespace *);
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 1a5485e..8ec0b92 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1016,6 +1016,11 @@ check_sym_interfaces (gfc_symbol * sym)
if (sym->ns != gfc_current_ns)
return;
+ if (sym->attr.if_source == IFSRC_IFBODY
+ && sym->attr.flavor == FL_PROCEDURE
+ && !sym->attr.mod_proc)
+ resolve_global_procedure (sym, &sym->declared_at, sym->attr.subroutine);
+
if (sym->generic != NULL)
{
sprintf (interface_name, "generic interface '%s'", sym->name);
@@ -1371,16 +1376,10 @@ compare_actual_formal (gfc_actual_arglist ** ap,
&& a->expr->expr_type == EXPR_VARIABLE
&& f->sym->attr.flavor == FL_PROCEDURE)
{
- gsym = gfc_find_gsymbol (gfc_gsym_root,
- a->expr->symtree->n.sym->name);
- if (gsym == NULL || (gsym->type != GSYM_FUNCTION
- && gsym->type != GSYM_SUBROUTINE))
- {
- if (where)
- gfc_error ("Expected a procedure for argument '%s' at %L",
- f->sym->name, &a->expr->where);
- return 0;
- }
+ if (where)
+ gfc_error ("Expected a procedure for argument '%s' at %L",
+ f->sym->name, &a->expr->where);
+ return 0;
}
if (f->sym->attr.flavor == FL_PROCEDURE
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index dc138d3..05056a5 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3090,6 +3090,16 @@ load_generic_interfaces (void)
sym->attr.generic = 1;
sym->attr.use_assoc = 1;
}
+ else
+ {
+ /* Unless sym is a generic interface, this reference
+ is ambiguous. */
+ gfc_symtree *st;
+ p = p ? p : name;
+ st = gfc_find_symtree (gfc_current_ns->sym_root, p);
+ st->ambiguous = sym->attr.generic ? 0 : 1;
+ }
+
if (i == 1)
{
mio_interface_rest (&sym->generic);
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index eaa939d..9794446 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1156,7 +1156,7 @@ find_noncopying_intrinsics (gfc_symbol * fnsym, gfc_actual_arglist * actual)
reference. The corresponding code that is called in creating
global entities is parse.c. */
-static void
+void
resolve_global_procedure (gfc_symbol *sym, locus *where, int sub)
{
gfc_gsymbol * gsym;
@@ -5560,7 +5560,6 @@ static try
resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
{
gfc_formal_arglist *arg;
- gfc_symtree *st;
if (sym->attr.ambiguous_interfaces && !sym->attr.referenced)
gfc_warning ("Although not referenced, '%s' at %L has ambiguous "
@@ -5570,16 +5569,6 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
&& resolve_fl_var_and_proc (sym, mp_flag) == FAILURE)
return FAILURE;
- st = gfc_find_symtree (gfc_current_ns->sym_root, sym->name);
- if (st && st->ambiguous
- && sym->attr.referenced
- && !sym->attr.generic)
- {
- gfc_error ("Procedure %s at %L is ambiguous",
- sym->name, &sym->declared_at);
- return FAILURE;
- }
-
if (sym->ts.type == BT_CHARACTER)
{
gfc_charlen *cl = sym->ts.cl;