https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102817
--- Comment #5 from anlauf at gcc dot gnu.org ---
I'm testing the following fix:
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 4dea840e348..c5360dfaede 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2129,6 +2129,7 @@ simplify_parameter_variable (gfc_expr *p, int type)
return false;
e->rank = p->rank;
+ e->shape = gfc_copy_shape (p->shape, p->rank);
if (e->ts.type == BT_CHARACTER && p->ts.u.cl)
e->ts = p->ts;
