--- gcc/fortran/interface.c 2014-09-03 20:25:45.000000000 +0300 +++ gcc/fortran/interface.c 2015-03-29 19:28:30.000000000 +0300 @@ -1456,7 +1456,7 @@ something goes wrong. */ static int -check_interface0 (gfc_interface *p, const char *interface_name) +check_interface0 (gfc_interface *p, const char *interface_name, gfc_symbol *origin) { gfc_interface *psave, *q, *qlast; @@ -1468,7 +1468,16 @@ if (((!p->sym->attr.function && !p->sym->attr.subroutine) || !p->sym->attr.if_source) && p->sym->attr.flavor != FL_DERIVED) - { + { + if ((p->sym->declared_at.lb == NULL) || (p->sym->declared_at.lb->file==NULL)) {//exit now + if (origin && origin->declared_at.lb->file ) { + gfc_error ( "undefined function/subroutine for %s at %L ",interface_name, &origin->declared_at); + return 1; + } + else { + gfc_error ( "undefined function/subroutine for %s ",interface_name); + return 1; + }} if (p->sym->attr.external) gfc_error ("Procedure '%s' in %s at %L has no explicit interface", p->sym->name, interface_name, &p->sym->declared_at); @@ -1587,7 +1596,7 @@ if (sym->generic != NULL) { sprintf (interface_name, "generic interface '%s'", sym->name); - if (check_interface0 (sym->generic, interface_name)) + if (check_interface0 (sym->generic, interface_name,sym)) return; for (p = sym->generic; p; p = p->next) @@ -1619,7 +1628,7 @@ gfc_namespace *ns; sprintf (interface_name, "operator interface '%s'", uop->name); - if (check_interface0 (uop->op, interface_name)) + if (check_interface0 (uop->op, interface_name,NULL)) return; for (ns = gfc_current_ns; ns; ns = ns->parent) @@ -1712,7 +1721,7 @@ sprintf (interface_name, "intrinsic '%s' operator", gfc_op2string ((gfc_intrinsic_op) i)); - if (check_interface0 (ns->op[i], interface_name)) + if (check_interface0 (ns->op[i], interface_name,NULL)) continue; if (ns->op[i])