https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98517
--- Comment #2 from kargl at gcc dot gnu.org --- diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 249f402b8d9..da8e3b63249 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12437,7 +12437,8 @@ resolve_charlen (gfc_charlen *cl) } /* cl->length has been resolved. It should have an integer type. */ - if (cl->length->ts.type != BT_INTEGER || cl->length->rank != 0) + if (cl->length + && (cl->length->ts.type != BT_INTEGER || cl->length->rank != 0)) { gfc_error ("Scalar INTEGER expression expected at %L", &cl->length->where);