https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102787
--- Comment #7 from anlauf at gcc dot gnu.org --- Slightly improved version of the patch of comment#6: diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 6552eaf3b0c..a63a6631f59 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -1812,6 +1812,29 @@ expand_constructor (gfc_constructor_base base) continue; } + /* Expand constant array within array constructor. */ + if (e->expr_type == EXPR_VARIABLE && e->rank && e->ref + && e->symtree && e->symtree->n.sym + && e->symtree->n.sym->attr.flavor == FL_PARAMETER + && e->symtree->n.sym->value + && e->symtree->n.sym->value->value.constructor) + { + gfc_array_ref *ar; + ar = gfc_find_array_ref (e); + if (ar && ar->as && ar->as->type == AS_EXPLICIT) + { + if (ar->type == AR_FULL) + { + gfc_expr *value = e->symtree->n.sym->value; + if (!expand_constructor (value->value.constructor)) + return false; + + continue; + } + /* TODO: handle ar->type == AR_SECTION. */ + } + } + empty_constructor = false; e = gfc_copy_expr (e); if (!gfc_simplify_expr (e, 1)) Still does not handle array sections.