https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100971
--- Comment #3 from anlauf at gcc dot gnu.org --- Just from a purely technical point, the following would allow to trigger the proper check, as it allows to look into arrays, and regtests OK: diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index d9d101775f6..bcf951ad756 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -10017,6 +10017,7 @@ resolve_transfer (gfc_code *code) if (exp == NULL || (exp->expr_type != EXPR_VARIABLE && exp->expr_type != EXPR_FUNCTION + && exp->expr_type != EXPR_ARRAY && exp->expr_type != EXPR_STRUCTURE)) return; @@ -10030,6 +10031,7 @@ resolve_transfer (gfc_code *code) const gfc_typespec *ts = exp->expr_type == EXPR_STRUCTURE || exp->expr_type == EXPR_FUNCTION + || exp->expr_type == EXPR_ARRAY ? &exp->ts : &exp->symtree->n.sym->ts; /* Go to actual component transferred. */ @@ -10128,6 +10130,9 @@ resolve_transfer (gfc_code *code) if (exp->expr_type == EXPR_STRUCTURE) return; + if (exp->expr_type == EXPR_ARRAY) + return; + sym = exp->symtree->n.sym; if (sym->as != NULL && sym->as->type == AS_ASSUMED_SIZE && exp->ref