+2018-02-24 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/30792
+ * decl.c (gfc_match_data): Check for invalid substring in
+ data-implied-do
+
2018-02-23 Steven G. Kargl <kargl@gcc.gnu.org>
* intrinsic.texi: Arguments to MATMUL cannot both be rank one.
if (m != MATCH_YES)
goto cleanup;
+ if (new_data->var->iter.var
+ && new_data->var->iter.var->ts.type == BT_INTEGER
+ && new_data->var->iter.var->symtree->n.sym->attr.implied_index == 1
+ && new_data->var->list
+ && new_data->var->list->expr
+ && new_data->var->list->expr->ts.type == BT_CHARACTER
+ && new_data->var->list->expr->ref
+ && new_data->var->list->expr->ref->type == REF_SUBSTRING)
+ {
+ gfc_error ("Invalid substring in data-implied-do at %L in DATA "
+ "statement", &new_data->var->list->expr->where);
+ goto cleanup;
+ }
+
m = top_val_list (new_data);
if (m != MATCH_YES)
goto cleanup;