http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44735
Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org, | |tkoenig at gcc dot gnu.org Known to fail| | --- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-29 22:18:34 UTC --- Hi Paul, The problem may well be where Joe pointed it out. In if (expr1->ts.type == BT_CHARACTER && expr1->ts.u.cl->length) { if (!expr1->ts.u.cl->backend_decl) { gfc_se tse; gfc_init_se (&tse, NULL); gfc_conv_expr (&tse, expr1->ts.u.cl->length); expr1->ts.u.cl->backend_decl = tse.expr; } type = gfc_get_character_type_len (gfc_default_character_kind, expr1->ts.u.cl->backend_decl); } the fact that expr1 has a substring reference is not taken into account, so it might be necessary to calculate the length of the string from expr1->ref->u.ss.end - expr1->ref.u.ss.start + 1. You may have to take care not to calculate any functions twice, though. Hope this helps a little bit.