re PR fortran/30792 (DATA implied-do substring allowed with -std=f95/f2003)

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-24  Steven G. Kargl <kargl@gcc.gnu.org>

	PR fortran/30792
	* gfortran.dg/data_substring.f90: New test.

From-SVN: r257962
This commit is contained in:
Steven G. Kargl 2018-02-24 17:22:10 +00:00
parent 118cd6baed
commit c034c38f8d
4 changed files with 31 additions and 0 deletions

View File

@ -1,3 +1,9 @@
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.

View File

@ -585,6 +585,20 @@ gfc_match_data (void)
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;

View File

@ -1,3 +1,8 @@
2018-02-24 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/30792
* gfortran.dg/data_substring.f90: New test.
2018-02-24 Marek Polacek <polacek@redhat.com>
PR c++/83692

View File

@ -0,0 +1,6 @@
! { dg-do compile }
! PR fortran/30792
character string*1025
integer i
data (string(i:i),i=1,1025)/1025*'?'/ ! { dg-error "Invalid substring" }
end