https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82367
Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tkoenig at gcc dot gnu.org --- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- (In reply to kargl from comment #3) > % svn diff resolve.c > Index: resolve.c > =================================================================== > --- resolve.c (revision 253236) > +++ resolve.c (working copy) > @@ -7387,8 +7387,14 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code, bo > if (code->ext.alloc.ts.type == BT_CHARACTER && !e->ts.deferred > && !UNLIMITED_POLY (e)) > { > - int cmp = gfc_dep_compare_expr (e->ts.u.cl->length, > - code->ext.alloc.ts.u.cl->length); > + int cmp; > + > + if (!e->ts.u.cl->length) > + goto failure; > + > + cmp = gfc_dep_compare_expr (e->ts.u.cl->length, > + code->ext.alloc.ts.u.cl->length); > + > if (cmp == 1 || cmp == -1 || cmp == -3) > { > gfc_error ("Allocating %s at %L with type-spec requires the same " Looks good (and obvious, too). Pre-approved.