aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index ab88ab5..c0fec90 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2105,6 +2105,14 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
}
}
+ if (sym->attr.flavor == FL_PARAMETER && sym->attr.dimension && sym->as
+ && sym->as->rank && init->rank && init->rank != sym->as->rank)
+ {
+ gfc_error ("Rank mismatch of array at %L and its initializer "
+ "(%d/%d)", &sym->declared_at, sym->as->rank, init->rank);
+ return false;
+ }
+
/* If sym is implied-shape, set its upper bounds from init. */
if (sym->attr.flavor == FL_PARAMETER && sym->attr.dimension
&& sym->as->type == AS_IMPLIED_SHAPE)