This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR fortran/77506
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 8 Sep 2016 17:13:39 -0700
- Subject: [PATCH] PR fortran/77506
- Authentication-results: sourceware.org; auth=none
- Reply-to: kargl at uw dot edu
Regression tested on x86_64-*-freebsd. OK to commit?
2016-09-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77506
* array.c (gfc_match_array_constructor): CHARACTER(len=*) cannot
appear in an array constructor.
2016-09-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77506
* gfortran.dg/pr77506.f90: New test.
Index: gcc/fortran/array.c
===================================================================
--- gcc/fortran/array.c (revision 240039)
+++ gcc/fortran/array.c (working copy)
@@ -1142,6 +1142,15 @@ gfc_match_array_constructor (gfc_expr **
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)
Index: gcc/testsuite/gfortran.dg/pr77506.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77506.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77506.f90 (working copy)
@@ -0,0 +1,4 @@
+! { dg-do compile }
+program foo
+ print *, [character(len=*)::'ab','cd'] ! { dg-error "contain an asterisk" }
+end program foo
--
Steve