[Bug fortran/93483] ICE in gfc_constructor_copy, at fortran/constructor.c:103
mikael at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Oct 14 19:19:36 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93483
--- Comment #20 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #19)
> (In reply to Mikael Morin from comment #18)
> > (In reply to Mikael Morin from comment #17)
> > > And something similar for the rest of the test (the binary operators).
> >
> > Like this:
> >
> It doesn't work unfortunately:
>
This one works:
diff --git a/gcc/fortran/arith.cc b/gcc/fortran/arith.cc
index 5e96bb9658e..c51ae105387 100644
--- a/gcc/fortran/arith.cc
+++ b/gcc/fortran/arith.cc
@@ -1318,7 +1318,7 @@ reduce_binary_ac (arith (*eval) (gfc_expr *, gfc_expr *,
gfc_expr **),
if (c->expr->expr_type == EXPR_CONSTANT)
rc = eval (c->expr, op2, &r);
- else if (c->expr->expr_type == EXPR_OP && c->expr->ts.type ==
BT_UNKNOWN)
+ else if (c->expr->expr_type != EXPR_ARRAY)
rc = ARITH_INVALID_TYPE;
else
rc = reduce_binary_ac (eval, c->expr, op2, &r);
@@ -1372,7 +1372,7 @@ reduce_binary_ca (arith (*eval) (gfc_expr *, gfc_expr *,
gfc_expr **),
if (c->expr->expr_type == EXPR_CONSTANT)
rc = eval (op1, c->expr, &r);
- else if (c->expr->expr_type == EXPR_OP && c->expr->ts.type ==
BT_UNKNOWN)
+ else if (c->expr->expr_type != EXPR_ARRAY)
rc = ARITH_INVALID_TYPE;
else
rc = reduce_binary_ca (eval, op1, c->expr, &r);
@@ -1433,8 +1433,8 @@ reduce_binary_aa (arith (*eval) (gfc_expr *, gfc_expr *,
gfc_expr **),
c && d;
c = gfc_constructor_next (c), d = gfc_constructor_next (d))
{
- if ((c->expr->expr_type == EXPR_OP && c->expr->ts.type == BT_UNKNOWN)
- || (d->expr->expr_type == EXPR_OP && d->expr->ts.type == BT_UNKNOWN))
+ if ((!(c->expr->expr_type == EXPR_CONSTANT || c->expr->expr_type ==
EXPR_ARRAY))
+ || (!(d->expr->expr_type == EXPR_CONSTANT || d->expr->expr_type ==
EXPR_ARRAY)))
rc = ARITH_INVALID_TYPE;
else
rc = reduce_binary (eval, c->expr, d->expr, &r);
More information about the Gcc-bugs
mailing list