2016-09-21 Louis Krupp <louis.krupp@zoho.com>
PR fortran/66107
* gfortran.dg/pr66107.f90: New test.
2016-09-21 Louis Krupp <louis.krupp@zoho.com>
PR fortran/66107
* decl.c (add_init_expr_to_sym): Catch variable character length
in parameter array.
From-SVN: r240341
+2016-09-21 Louis Krupp <louis.krupp@zoho.com>
+
+ PR fortran/66107
+ * decl.c (add_init_expr_to_sym): Catch variable character length
+ in parameter array.
+
2016-09-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/77657
else if (init->expr_type == EXPR_ARRAY)
{
if (init->ts.u.cl)
- clen = mpz_get_si (init->ts.u.cl->length->value.integer);
+ {
+ const gfc_expr *length = init->ts.u.cl->length;
+ if (length->expr_type != EXPR_CONSTANT)
+ {
+ gfc_error ("Cannot initialize parameter array "
+ "at %L "
+ "with variable length elements",
+ &sym->declared_at);
+ return false;
+ }
+ clen = mpz_get_si (length->value.integer);
+ }
else if (init->value.constructor)
{
gfc_constructor *c;
+2016-09-21 Louis Krupp <louis.krupp@zoho.com>
+
+ PR fortran/66107
+ * gfortran.dg/pr66107.f90: New test.
+
2016-09-21 Ian Lance Taylor <iant@golang.org>
* go.go-torture/execute/map-1.go: Replace old map deletion syntax
--- /dev/null
+! { dg-do compile }
+! PR fortran/66107
+subroutine p
+ integer n
+ character(*), parameter :: z(1) = [character(len=n) :: 'x'] ! { dg-error "Cannot initialize parameter array at .1. with variable length elements" }
+end subroutine