https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103716
--- Comment #5 from anlauf at gcc dot gnu.org --- The following partial revert of r10-7334 avoids the ICE and restores the bug in gcc-9: diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index bff1b35446f..245c4e1683f 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5436,7 +5436,7 @@ gfc_resolve_ref (gfc_expr *expr) case REF_INQUIRY: /* Implement requirement in note 9.7 of F2018 that the result of the LEN inquiry be a scalar. */ - if (ref->u.i == INQUIRY_LEN && array_ref && expr->ts.deferred) + if (ref->u.i == INQUIRY_LEN && array_ref) { array_ref->u.ar.type = AR_ELEMENT; expr->rank = 0;