------- Comment #7 from fxcoudert at gcc dot gnu dot org 2007-09-19 11:52 ------- Mine. A straightforward patch following the idea laid in my previous comment fixes it.
Index: arith.c =================================================================== --- arith.c (revision 128540) +++ arith.c (working copy) @@ -1288,7 +1288,11 @@ reduce_unary (arith (*eval) (gfc_expr *, for (c = head; c; c = c->next) { - rc = eval (c->expr, &r); + if (c->expr->expr_type == EXPR_CONSTANT) + rc = eval (c->expr, &r); + else + rc = reduce_unary (eval, c->expr, &r); + if (rc != ARITH_OK) break; @@ -1328,7 +1332,11 @@ reduce_binary_ac (arith (*eval) (gfc_exp for (c = head; c; c = c->next) { - rc = eval (c->expr, op2, &r); + if (c->expr->expr_type == EXPR_CONSTANT) + rc = eval (c->expr, op2, &r); + else + rc = reduce_binary_ac (eval, c->expr, op2, &r); + if (rc != ARITH_OK) break; @@ -1368,7 +1376,11 @@ reduce_binary_ca (arith (*eval) (gfc_exp for (c = head; c; c = c->next) { - rc = eval (op1, c->expr, &r); + if (c->expr->expr_type == EXPR_CONSTANT) + rc = eval (op1, c->expr, &r); + else + rc = reduce_binary_ca (eval, op1, c->expr, &r); + if (rc != ARITH_OK) break; @@ -1395,6 +1407,11 @@ reduce_binary_ca (arith (*eval) (gfc_exp } +/* We need a forward declaration of reduce_binary. */ +static arith reduce_binary (arith (*eval) (gfc_expr *, gfc_expr *, gfc_expr **), + gfc_expr *op1, gfc_expr *op2, gfc_expr **result); + + static arith reduce_binary_aa (arith (*eval) (gfc_expr *, gfc_expr *, gfc_expr **), gfc_expr *op1, gfc_expr *op2, gfc_expr **result) @@ -1421,7 +1438,7 @@ reduce_binary_aa (arith (*eval) (gfc_exp break; } - rc = eval (c->expr, d->expr, &r); + rc = reduce_binary (eval, c->expr, d->expr, &r); if (rc != ARITH_OK) break; -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Keywords| |patch Last reconfirmed|2007-09-03 09:34:53 |2007-09-19 11:52:17 date| | Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33288