https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59016
--- Comment #9 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- I have tested on trunk (5.0) the following variant --- ../_clean/gcc/fortran/interface.c 2015-03-25 14:07:04.000000000 +0100 +++ gcc/fortran/interface.c 2015-03-30 10:05:08.000000000 +0200 @@ -1558,7 +1569,7 @@ next: 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; @@ -1571,7 +1582,16 @@ check_interface0 (gfc_interface *p, cons || !p->sym->attr.if_source) && p->sym->attr.flavor != FL_DERIVED) { - if (p->sym->attr.external) + if (origin) + { + /* since program crashes, print access statement info or just the name; then exit! */ + if (origin->declared_at.lb->file) + gfc_error ("undefined function/subroutine for %s at %L ", + interface_name, &origin->declared_at); + else + gfc_error ("undefined function/subroutine for %s ",interface_name); + } + else if (p->sym->attr.external) gfc_error ("Procedure %qs in %s at %L has no explicit interface", p->sym->name, interface_name, &p->sym->declared_at); else @@ -1689,7 +1709,7 @@ check_sym_interfaces (gfc_symbol *sym) 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) @@ -1721,7 +1741,7 @@ check_uop_interfaces (gfc_user_op *uop) 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) @@ -1814,7 +1834,7 @@ gfc_check_interfaces (gfc_namespace *ns) 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]) It fixes this PR and at least pr56674, pr58813, pr59024, and pr65469. However it causes the following regressions: FAIL: gfortran.dg/constructor_9.f90 -O (test for errors, line 13) FAIL: gfortran.dg/constructor_9.f90 -O (test for excess errors) FAIL: gfortran.dg/generic_14.f90 -O (test for errors, line 90) FAIL: gfortran.dg/generic_14.f90 -O (test for errors, line 99) FAIL: gfortran.dg/generic_14.f90 -O (test for excess errors) FAIL: gfortran.dg/keyword_symbol_1.f90 -O (test for errors, line 20) FAIL: gfortran.dg/keyword_symbol_1.f90 -O (test for excess errors) FAIL: gfortran.dg/proc_decl_3.f90 -O (test for errors, line 37) FAIL: gfortran.dg/proc_decl_3.f90 -O (test for errors, line 38) FAIL: gfortran.dg/proc_decl_3.f90 -O (test for errors, line 39) FAIL: gfortran.dg/proc_decl_3.f90 -O (test for excess errors)