Hi all, I have just committed a completely obvious patch for this PR. All it does is rearrange some expressions to avoid an ICE (see attachment):
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=243005 Cheers, Janus
Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 243004) +++ gcc/fortran/interface.c (working copy) @@ -4933,15 +4933,15 @@ gfc_find_specific_dtio_proc (gfc_symbol *derived, && tb_io_st->n.sym && tb_io_st->n.sym->generic) { - gfc_interface *intr; - for (intr = tb_io_st->n.sym->generic; intr; intr = intr->next) + for (gfc_interface *intr = tb_io_st->n.sym->generic; + intr && intr->sym && intr->sym->formal; + intr = intr->next) { gfc_symbol *fsym = intr->sym->formal->sym; - if (intr->sym && intr->sym->formal - && ((fsym->ts.type == BT_CLASS - && CLASS_DATA (fsym)->ts.u.derived == extended) - || (fsym->ts.type == BT_DERIVED - && fsym->ts.u.derived == extended))) + if ((fsym->ts.type == BT_CLASS + && CLASS_DATA (fsym)->ts.u.derived == extended) + || (fsym->ts.type == BT_DERIVED + && fsym->ts.u.derived == extended)) { dtio_sub = intr->sym; break; Index: gcc/testsuite/gfortran.dg/dtio_18.f90 =================================================================== --- gcc/testsuite/gfortran.dg/dtio_18.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/dtio_18.f90 (working copy) @@ -0,0 +1,15 @@ +! { dg-do compile } +! +! PR 78592: [7 Regression] ICE in gfc_find_specific_dtio_proc, at fortran/interface.c:4939 +! +! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> + +program p + type t + end type + type(t) :: z + interface write(formatted) + module procedure wf ! { dg-error "is neither function nor subroutine" } + end interface + print *, z +end