Commit 39abef62 by Louis Krupp Committed by Louis Krupp

re PR fortran/66107 (ICE on missing parameter value for initialisation (segfault))

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
parent 41501d1a
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
......
......@@ -1672,7 +1672,18 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
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
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment