https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71203
--- Comment #8 from Harald Anlauf <anlauf at gmx dot de> --- The following obvious patch fixes the character-related issues (z1,z2,z3,z3a,z3b): Index: expr.c =================================================================== --- expr.c (revision 269357) +++ expr.c (working copy) @@ -1897,8 +1897,14 @@ string_len = 0; if (!p->ts.u.cl) - p->ts.u.cl = gfc_new_charlen (p->symtree->n.sym->ns, - NULL); + { + if (p->symtree) + p->ts.u.cl = gfc_new_charlen (p->symtree->n.sym->ns, + NULL); + else + p->ts.u.cl = gfc_new_charlen (gfc_current_ns, + NULL); + } else gfc_free_expr (p->ts.u.cl->length); However, due to my limited understanding of namespace handling, this might be an improper solution. The cases z4,z5 are different issues.