This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/69514] ICE with nested array constructor
- From: "lkrupp at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 03 Sep 2016 10:05:42 +0000
- Subject: [Bug fortran/69514] ICE with nested array constructor
- Auto-submitted: auto-generated
- References: <bug-69514-4@http.gcc.gnu.org/bugzilla/>
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);