http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53685
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-15 17:02:44 UTC --- (In reply to comment #1) > (a) A minor one that in the second case, the length of "record_type" is > "e->ts->u.cl->length == NULL" instead of 4 (as one could be simply > calculated). That should be fixed by the following patch (untested). The question is why e->ref->type == REF_SUBSTRING was excluded if (and only if) it was the first reference? The whole condition plus function call was added 2007-08-31 in the big patch for PR fortran/31879, PR fortran/31197, PR fortran/31258 and PR fortran/32703: http://gcc.gnu.org/viewcvs?view=revision&revision=127939 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -6325,4 +6325,3 @@ gfc_resolve_expr (gfc_expr *e) - if (e->ts.type == BT_CHARACTER && e->ts.u.cl == NULL && e->ref - && e->ref->type != REF_SUBSTRING) + if (e->ts.type == BT_CHARACTER && e->ts.u.cl == NULL && e->ref) gfc_resolve_substring_charlen (e);