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

--- Comment #14 from anlauf at gcc dot gnu.org ---
Is it conceivable that a somewhat weaker form of simplification, which
addresses the parentheses as well as the basic unary and binary operators
could still be used for the time being?

There is simplify_intrinsic_op; it just needs to be made non-static.
And seems to work here, also for Mikael's example.

So on top of the posted patch,

diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc
index 9bec299f160..4e937a4990f 100644
--- a/gcc/fortran/array.cc
+++ b/gcc/fortran/array.cc
@@ -1207,7 +1207,7 @@ walk_array_constructor (gfc_typespec *ts,
gfc_constructor_base head)
       e = c->expr;

       if (e->expr_type == EXPR_OP)
-       gfc_simplify_expr (e, 0);
+       simplify_intrinsic_op (e, 0);

       if (e->expr_type == EXPR_ARRAY && e->ts.type == BT_UNKNOWN
          && !e->ref && e->value.constructor)
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 10bb098d136..37dceacbb54 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -3627,6 +3627,7 @@ gfc_expr *gfc_build_conversion (gfc_expr *);
 void gfc_free_ref_list (gfc_ref *);
 void gfc_type_convert_binary (gfc_expr *, int);
 bool gfc_is_constant_expr (gfc_expr *);
+bool simplify_intrinsic_op (gfc_expr *, int);
 bool gfc_simplify_expr (gfc_expr *, int);
 bool gfc_try_simplify_expr (gfc_expr *, int);
 int gfc_has_vector_index (gfc_expr *);

Reply via email to