Le 05/10/2022 à 10:51, Mikael Morin a écrit :

Unfortunately, it doesn't fix the bogus incommensurate arrays errors.


The following does.


diff --git a/gcc/fortran/arith.cc b/gcc/fortran/arith.cc
index e6e35ef3c42..2c57c796270 100644
--- a/gcc/fortran/arith.cc
+++ b/gcc/fortran/arith.cc
@@ -1443,7 +1443,7 @@ reduce_binary_aa (arith (*eval) (gfc_expr *, gfc_expr *, gfc_expr **),
        gfc_replace_expr (c->expr, r);
     }

-  if (c || d)
+  if (rc == ARITH_OK && (c || d))
     rc = ARITH_INCOMMENSURATE;

   if (rc != ARITH_OK)


There is one last thing that I'm dissatisfied with.
The handling of unknown types should be moved to reduce_binary, because the dispatching in reduce_binary doesn't handle EXPR_OP, so even if either or both operands are scalar, they are handled by the (array vs array) reduce_binary_aa function. That's confusing.

Reply via email to