Hi. Starting from r266926 'switch (e->value.op.op)' is reached when one using -fdec. That's wrong as -fdec causes to create a e->value.function. I hope the proper fix is to skip the mentioned patch and allow simplification at the end of the function?
Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/fortran/ChangeLog: 2019-01-25 Martin Liska <mli...@suse.cz> PR fortran/88649 * resolve.c (resolve_operator): Initialize 't' right after function entry. Skip switch (e->value.op.op) for -fdec operands that become function calls. --- gcc/fortran/resolve.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 2c49aeab5f9..02dfbb8c56d 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -3880,7 +3880,7 @@ resolve_operator (gfc_expr *e) gfc_expr *op1, *op2; char msg[200]; bool dual_locus_error; - bool t; + bool t = true; /* Resolve all subnodes-- give them types. */ @@ -4002,7 +4002,7 @@ resolve_operator (gfc_expr *e) if (op2->ts.type != e->ts.type || op2->ts.kind != e->ts.kind) gfc_convert_type (op2, &e->ts, 1); e = logical_to_bitwise (e); - break; + goto simplify_op; } sprintf (msg, _("Operands of logical operator %%<%s%%> at %%L are %s/%s"), @@ -4018,7 +4018,7 @@ resolve_operator (gfc_expr *e) e->ts.type = BT_INTEGER; e->ts.kind = op1->ts.kind; e = logical_to_bitwise (e); - break; + goto simplify_op; } if (op1->ts.type == BT_LOGICAL) @@ -4143,8 +4143,6 @@ resolve_operator (gfc_expr *e) /* Deal with arrayness of an operand through an operator. */ - t = true; - switch (e->value.op.op) { case INTRINSIC_PLUS: @@ -4234,6 +4232,8 @@ resolve_operator (gfc_expr *e) break; } +simplify_op: + /* Attempt to simplify the expression. */ if (t) {