https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101564
--- Comment #3 from kargl at gcc dot gnu.org --- (In reply to anlauf from comment #2) > The %kind was introduced probably in r9, so likely not a real regression. > > I am testing the following patch: > > diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c > index 45c3ad387ac..51d312116eb 100644 > --- a/gcc/fortran/resolve.c > +++ b/gcc/fortran/resolve.c > @@ -8165,6 +8165,9 @@ resolve_allocate_deallocate (gfc_code *code, const > char *fcn) > gfc_error ("Stat-variable at %L must be a scalar INTEGER " > "variable", &stat->where); > > + if (stat->expr_type == EXPR_CONSTANT || stat->symtree == NULL) > + goto done_stat; > + > for (p = code->ext.alloc.list; p; p = p->next) > if (p->expr->symtree->n.sym->name == stat->symtree->n.sym->name) > { > @@ -8192,6 +8195,8 @@ resolve_allocate_deallocate (gfc_code *code, const > char *fcn) > } > } > > +done_stat: > + > /* Check the errmsg variable. */ > if (errmsg) > { The patch I posted is simpler, but yours will also do the trick.