This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/69514] ICE with nested array constructor


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

--- Comment #4 from lkrupp at gcc dot gnu.org ---
This patch is a kludge.  I don't recommend it.  But it does fix at least one of
the test cases, it passes the test suite, and it might point to a proper
solution:

Index: arith.c
===================================================================
--- arith.c     (revision 239966)
+++ arith.c     (working copy)
@@ -1326,7 +1326,21 @@ reduce_binary_ca (arith (*eval) (gfc_expr *, gfc_e
   for (c = gfc_constructor_first (head); c; c = gfc_constructor_next (c))
     {
       if (c->expr->expr_type == EXPR_CONSTANT)
-       rc = eval (op1, c->expr, &r);
+       {
+         /* The conversion *should* be done only if necessary. */    
+         gfc_expr temp;
+
+         temp.expr_type = EXPR_OP;
+         gfc_clear_ts (&temp.ts);
+
+         temp.value.op.op = INTRINSIC_PLUS; /* Arbitrary */
+         temp.value.op.op1 = op1;
+         temp.value.op.op2 = c->expr;
+
+         gfc_type_convert_binary (&temp,
+           warn_conversion || warn_conversion_extra);
+
+         rc = eval (op1, c->expr, &r);
+       }
       else
        rc = reduce_binary_ca (eval, op1, c->expr, &r);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]