aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 74f7669..521876e 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1123,7 +1123,8 @@ compare_parameter (gfc_symbol * formal, gfc_expr * actual,
&& !compare_type_rank (formal, actual->symtree->n.sym))
return 0;
- if (formal->attr.if_source == IFSRC_UNKNOWN)
+ if (formal->attr.if_source == IFSRC_UNKNOWN
+ || actual->symtree->n.sym->attr.external)
return 1; /* Assume match */
return compare_interfaces (formal, actual->symtree->n.sym, 0);
@@ -1177,6 +1178,7 @@ compare_actual_formal (gfc_actual_arglist ** ap,
{
gfc_actual_arglist **new, *a, *actual, temp;
gfc_formal_arglist *f;
+ gfc_gsymbol *gsym;
int i, n, na;
bool rank_check;
@@ -1276,6 +1278,24 @@ compare_actual_formal (gfc_actual_arglist ** ap,
return 0;
}
+ /* Satisfy 12.4.1.2 by ensuring that a procedure actual argument is
+ provided for a procedure formal argument. */
+ if (a->expr->ts.type != BT_PROCEDURE
+ && 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 (f->sym->as
&& f->sym->as->type == AS_ASSUMED_SHAPE
&& a->expr->expr_type == EXPR_VARIABLE