Hello,

On 27/11/2021 21:56, Harald Anlauf via Fortran wrote:
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 6552eaf3b0c..fbc66097c80 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -1804,6 +1804,12 @@ expand_constructor (gfc_constructor_base base)
       if (empty_constructor)
        empty_ts = e->ts;

+      /* Simplify constant array expression/section within constructor.  */
+      if (e->expr_type == EXPR_VARIABLE && e->rank > 0 && e->ref
+         && e->symtree && e->symtree->n.sym
+         && e->symtree->n.sym->attr.flavor == FL_PARAMETER)
+       gfc_simplify_expr (e, 0);
+
       if (e->expr_type == EXPR_ARRAY)
        {
          if (!expand_constructor (e->value.constructor))

There is another simplification call just a few lines below, that I thought could just be moved up. But it works on a copy of the expression, and managing the copy makes it complex as well, so let’s do it your way.

OK.

Reply via email to