https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93483

--- Comment #17 from Mikael Morin <mikael at gcc dot gnu.org> ---
There is the possibility to bail out at the very point where things are about
to go wrong, and hope that at resolution time simplification will happen.
Like this for the first part of the test from the patch:

diff --git a/gcc/fortran/arith.cc b/gcc/fortran/arith.cc
index 9e079e42995..5e96bb9658e 100644
--- a/gcc/fortran/arith.cc
+++ b/gcc/fortran/arith.cc
@@ -1267,6 +1267,9 @@ reduce_unary (arith (*eval) (gfc_expr *, gfc_expr **),
gfc_expr *op,
   if (op->expr_type == EXPR_CONSTANT)
     return eval (op, result);

+  if (op->expr_type != EXPR_ARRAY)
+    return ARITH_INVALID_TYPE;
+
   rc = ARITH_OK;
   head = gfc_constructor_copy (op->value.constructor);
   for (c = gfc_constructor_first (head); c; c = gfc_constructor_next (c))


And something similar for the rest of the test (the binary operators).

Reply via email to