https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125458
--- Comment #10 from Mikael Morin <mikael at gcc dot gnu.org> ---
Maybe just remove the simplification during matching?
Like this (multiplication and division only, but you get the idea):
diff --git a/gcc/fortran/matchexp.cc b/gcc/fortran/matchexp.cc
index e2e23f25423..257e3449381 100644
--- a/gcc/fortran/matchexp.cc
+++ b/gcc/fortran/matchexp.cc
@@ -404,7 +404,7 @@ match_ext_mult_operand (gfc_expr **result)
static match
match_add_operand (gfc_expr **result)
{
- gfc_expr *all, *e, *total;
+ gfc_expr *all, *e;
locus where, old_loc;
match m;
gfc_intrinsic_op i;
@@ -444,20 +444,7 @@ match_add_operand (gfc_expr **result)
return MATCH_ERROR;
}
- if (i == INTRINSIC_TIMES)
- total = gfc_multiply (all, e);
- else
- total = gfc_divide (all, e);
-
- if (total == NULL)
- {
- gfc_free_expr (all);
- gfc_free_expr (e);
- return MATCH_ERROR;
- }
-
- all = total;
- all->where = where;
+ all = gfc_get_operator_expr (&where, i, all, e);
}
*result = all;