https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104848
--- Comment #3 from anlauf at gcc dot gnu.org --- Workaround: using -fno-range-check produces an error where appropriate. Debugging suggests a potential fix for the ICE (needs testing): diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index c9c0ba4cc2e..cfafe10f727 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -1293,7 +1293,7 @@ simplify_intrinsic_op (gfc_expr *p, int type) gfc_internal_error ("simplify_intrinsic_op(): Bad operator"); } - if (result == NULL) + if (result == NULL || result->expr_type == EXPR_UNKNOWN) { gfc_free_expr (op1); gfc_free_expr (op2); But that may be just a band-aid.