https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68108
Mikael Morin <mikael at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> --- (In reply to kargl from comment #1) > Tentative patch > > Index: decl.c > =================================================================== > --- decl.c (revision 229390) > +++ decl.c (working copy) > @@ -754,7 +754,8 @@ char_len_param_value (gfc_expr **expr, b > > gfc_reduce_init_expr (e); > > - if ((e->ref && e->ref->u.ar.type != AR_ELEMENT) > + if ((e->ref && e->ref->type == REF_ARRAY > + && e->ref->u.ar.type != AR_ELEMENT) > || (!e->ref && e->expr_type == EXPR_ARRAY)) There is another unguarded ref->u.ar access a few lines above. It doesn't trigger as often, because it's a == condition, but it's still worth fixing. Otherwise looks good.