From: Steven G. Kargl Date: Fri, 9 Sep 2016 18:04:23 +0000 (+0000) Subject: re PR fortran/77506 (F2008 Standard does not allow CHARACTER(LEN=*) in array constructor) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e81e83d04796b834c9f3e63d74b7202bca28e5c9;p=gcc.git re PR fortran/77506 (F2008 Standard does not allow CHARACTER(LEN=*) in array constructor) 2016-09-09 Steven G. Kargl PR fortran/77506 * array.c (gfc_match_array_constructor): CHARACTER(len=*) cannot appear in an array constructor. 2016-09-09 Steven G. Kargl PR fortran/77506 * gfortran.dg/pr77506.f90: New test. From-SVN: r240052 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a0afe045b9a..284bf7d92c0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-09-09 Steven G. Kargl + + PR fortran/77506 + * array.c (gfc_match_array_constructor): CHARACTER(len=*) cannot + appear in an array constructor. + 2016-09-09 Steven G. Kargl PR fortran/77507 diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 48a7250d108..14e20a36de5 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -1142,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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 407bc30084c..56ff8bc9ff9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-09 Steven G. Kargl + + PR fortran/77506 + * gfortran.dg/pr77506.f90: New test. + 2016-09-09 Steven G. Kargl PR fortran/77507 diff --git a/gcc/testsuite/gfortran.dg/pr77506.f90 b/gcc/testsuite/gfortran.dg/pr77506.f90 new file mode 100644 index 00000000000..70d874e260b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77506.f90 @@ -0,0 +1,4 @@ +! { dg-do compile } +program foo + print *, [character(len=*)::'ab','cd'] ! { dg-error "contain an asterisk" } +end program foo