https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105813
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Thu, Jun 23, 2022 at 09:18:40PM +0000, anlauf at gcc dot gnu.org wrote: > > --- Comment #2 from anlauf at gcc dot gnu.org --- > Simpler fix: > > diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc > index 0c2cb50c6a7..91d87a1b2c1 100644 > --- a/gcc/fortran/check.cc > +++ b/gcc/fortran/check.cc > @@ -6353,6 +6353,8 @@ gfc_check_unpack (gfc_expr *vector, gfc_expr *mask, > gfc_expr *field) > if (!same_type_check (vector, 0, field, 2)) > return false; > > + gfc_simplify_expr (mask, 0); > + > if (mask->expr_type == EXPR_ARRAY > && gfc_array_size (vector, &vector_size)) > { > If it survives regression testing, then I think it can be committed.