https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107054
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Target Milestone|--- |10.5 CC| |anlauf at gcc dot gnu.org Last reconfirmed| |2022-09-27 Status|UNCONFIRMED |NEW Priority|P3 |P4 --- Comment #2 from anlauf at gcc dot gnu.org --- Confirmed. We hit an assert that is fixed by: diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc index c0fbd0ed7c2..6ac92cf9db8 100644 --- a/gcc/fortran/simplify.cc +++ b/gcc/fortran/simplify.cc @@ -8458,9 +8458,16 @@ gfc_simplify_unpack (gfc_expr *vector, gfc_expr *mask, gfc_expr *field) { if (mask_ctor->expr->value.logical) { - gcc_assert (vector_ctor); - e = gfc_copy_expr (vector_ctor->expr); - vector_ctor = gfc_constructor_next (vector_ctor); + if (vector_ctor) + { + e = gfc_copy_expr (vector_ctor->expr); + vector_ctor = gfc_constructor_next (vector_ctor); + } + else + { + gfc_free_expr (result); + return NULL; + } } else if (field->expr_type == EXPR_ARRAY) e = gfc_copy_expr (field_ctor->expr);