https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106857
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org --- Comment #3 from anlauf at gcc dot gnu.org --- (In reply to anlauf from comment #1) > Obvious fix for NULL pointer dereference: > > diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc > index bc178d54891..d5c4fe8443d 100644 > --- a/gcc/fortran/simplify.cc > +++ b/gcc/fortran/simplify.cc > @@ -6431,7 +6432,7 @@ gfc_simplify_pack (gfc_expr *array, gfc_expr *mask, > gfc_expr *vector) > /* Copy only those elements of ARRAY to RESULT whose > MASK equals .TRUE.. */ > mask_ctor = gfc_constructor_first (mask->value.constructor); > - while (mask_ctor) > + while (mask_ctor && array_ctor) > { > if (mask_ctor->expr->value.logical) > { This regtests fine. Taking.