https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100950
--- Comment #7 from anlauf at gcc dot gnu.org --- Setting a breakpoint in gfc_simplify_len, it appears that the substring length is not properly set: (gdb) p e->ref->type $4 = REF_SUBSTRING (gdb) p *e->ref->u.ss.start->value.integer._mp_d $15 = 1 (gdb) p *e->ref->u.ss.end->value.integer._mp_d $16 = 2 (gdb) p *e->ref->u.ss.length->length->value.integer._mp_d $17 = 8