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

--- Comment #8 from anlauf at gcc dot gnu.org ---
Simpler and better patch which handles array sections as well as vector
subscripts:

diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 6552eaf3b0c..f870c225195 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;

+      /* Expand constant array within array 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))

Reply via email to