https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103777
--- Comment #3 from anlauf at gcc dot gnu.org --- Minimal fix (for maskl): diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 90067b6bbe6..45080e8b912 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -4909,6 +4909,9 @@ gfc_simplify_maskl (gfc_expr *i, gfc_expr *kind_arg) bool fail = gfc_extract_int (i, &arg); gcc_assert (!fail); + if (!gfc_check_mask (i, kind_arg)) + return &gfc_bad_expr; + result = gfc_get_constant_expr (BT_INTEGER, kind, &i->where); /* MASKL(n) = 2^bit_size - 2^(bit_size - n) */