https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104330
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #3 from anlauf at gcc dot gnu.org --- (In reply to kargl from comment #2) > NULL pointer dereference. This fixes the ICE. Don't know if the compiled > code is correct. I don't have CLASS in my codes. > > diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc > index 233cc42137f..542c8cb5537 100644 > --- a/gcc/fortran/simplify.cc > +++ b/gcc/fortran/simplify.cc > @@ -8295,7 +8295,7 @@ gfc_simplify_image_index (gfc_expr *coarray, gfc_expr > *sub) > if (ref->type == REF_COMPONENT) > as = ref->u.ar.as; > > - if (as->type == AS_DEFERRED) > + if (!as || as->type == AS_DEFERRED) > return NULL; > > /* "valid sequence of cosubscripts" are required; thus, return 0 unless Steve, I think it is obvious that we cannot simplify IMAGE_INDEX here. If you don't object, I will commit your fix for you as obvious.