http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57966
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org --- Comment #2 from janus at gcc dot gnu.org --- Draft patch (not regtested yet): Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 201038) +++ gcc/fortran/resolve.c (working copy) @@ -5638,14 +5638,6 @@ resolve_compcall (gfc_expr* e, const char **name) gfc_actual_arglist* newactual; gfc_symtree* target; - /* Check that's really a FUNCTION. */ - if (!e->value.compcall.tbp->function) - { - gfc_error ("'%s' at %L should be a FUNCTION", - e->value.compcall.name, &e->where); - return false; - } - /* These must not be assign-calls! */ gcc_assert (!e->value.compcall.assign); @@ -5661,6 +5653,15 @@ resolve_compcall (gfc_expr* e, const char **name) return false; gcc_assert (!e->value.compcall.tbp->is_generic); + /* Check that it's really a FUNCTION. */ + if (!e->value.compcall.tbp->function + && !e->value.compcall.tbp->u.specific->n.sym->attr.function) + { + gfc_error ("'%s' at %L should be a FUNCTION", + e->value.compcall.name, &e->where); + return false; + } + /* Take the rank from the function's symbol. */ if (e->value.compcall.tbp->u.specific->n.sym->as) e->rank = e->value.compcall.tbp->u.specific->n.sym->as->rank;