summaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-21 19:05:35 +0000
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-21 19:05:35 +0000
commit2fe3057a4ef15ca596097a26295fb7a83316b861 (patch)
tree3160767e4f7c3939cd7b606a23072d4c87d6230b /gcc/fortran/interface.c
parent889392a6208effab65ab49dae56572a6951c7fed (diff)
downloadgcc-2fe3057a4ef15ca596097a26295fb7a83316b861.tar.gz
2009-06-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/39850 * interface.c (gfc_compare_interfaces): Take care of implicit typing when checking the function attribute. Plus another bugfix. (compare_parameter): Set attr.function and attr.subroutine according to the usage of a procedure as actual argument. 2009-06-21 Janus Weil <janus@gcc.gnu.org> PR fortran/39850 * gfortran.dg/interface_19.f90: Add 'cleanup-modules'. * gfortran.dg/interface_20.f90: Ditto. * gfortran.dg/interface_21.f90: Ditto. * gfortran.dg/interface_22.f90: Ditto. * gfortran.dg/interface_30.f90: New. * gfortran.dg/proc_ptr_11.f90: Fix invalid test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148767 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 4954389848b..7d26fe444f9 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -939,7 +939,9 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, int generic_flag,
{
gfc_formal_arglist *f1, *f2;
- if (s1->attr.function && !s2->attr.function)
+ if (s1->attr.function && (s2->attr.subroutine
+ || (!s2->attr.function && s2->ts.type == BT_UNKNOWN
+ && gfc_get_default_type (s2->name, s2->ns)->type == BT_UNKNOWN)))
{
if (errmsg != NULL)
snprintf (errmsg, err_len, "'%s' is not a function", s2->name);
@@ -967,8 +969,6 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, int generic_flag,
"of '%s'", s2->name);
return 0;
}
- if (s1->attr.if_source == IFSRC_DECL)
- return 1;
}
if (s1->attr.if_source == IFSRC_UNKNOWN
@@ -1388,6 +1388,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
if (actual->ts.type == BT_PROCEDURE)
{
char err[200];
+ gfc_symbol *act_sym = actual->symtree->n.sym;
if (formal->attr.flavor != FL_PROCEDURE)
{
@@ -1396,7 +1397,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
return 0;
}
- if (!gfc_compare_interfaces (formal, actual->symtree->n.sym, 0, 1, err,
+ if (!gfc_compare_interfaces (formal, act_sym, 0, 1, err,
sizeof(err)))
{
if (where)
@@ -1405,6 +1406,13 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
return 0;
}
+ if (formal->attr.function && !act_sym->attr.function)
+ gfc_add_function (&act_sym->attr, act_sym->name, &act_sym->declared_at);
+
+ if (formal->attr.subroutine && !act_sym->attr.subroutine)
+ gfc_add_subroutine (&act_sym->attr, act_sym->name,
+ &act_sym->declared_at);
+
return 1;
}