summaryrefslogtreecommitdiff
path: root/gcc/fortran/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/array.c')
-rw-r--r--gcc/fortran/array.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 03c8b17178c..14e20a36de5 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -1089,6 +1089,7 @@ match_array_cons_element (gfc_constructor_base *result)
match
gfc_match_array_constructor (gfc_expr **result)
{
+ gfc_constructor *c;
gfc_constructor_base head, new_cons;
gfc_undo_change_set changed_syms;
gfc_expr *expr;
@@ -1141,6 +1142,15 @@ gfc_match_array_constructor (gfc_expr **result)
gfc_restore_last_undo_checkpoint ();
goto cleanup;
}
+
+ if (ts.type == BT_CHARACTER
+ && ts.u.cl && !ts.u.cl->length && !ts.u.cl->length_from_typespec)
+ {
+ gfc_error ("Type-spec at %L cannot contain an asterisk for a "
+ "type parameter", &where);
+ gfc_restore_last_undo_checkpoint ();
+ goto cleanup;
+ }
}
}
else if (m == MATCH_ERROR)
@@ -1194,8 +1204,6 @@ done:
be converted. See PR fortran/67803. */
if (ts.type == BT_CHARACTER)
{
- gfc_constructor *c;
-
c = gfc_constructor_first (head);
for (; c; c = gfc_constructor_next (c))
{
@@ -1218,6 +1226,14 @@ done:
}
}
}
+
+ /* Walk the constructor and ensure type conversion for numeric types. */
+ if (gfc_numeric_ts (&ts))
+ {
+ c = gfc_constructor_first (head);
+ for (; c; c = gfc_constructor_next (c))
+ gfc_convert_type (c->expr, &ts, 1);
+ }
}
else
expr = gfc_get_array_expr (BT_UNKNOWN, 0, &where);