Commit e4f7a5df by Steven G. Kargl

re PR fortran/69867 (ICE on initializing character in type with array of incompatible data)

2016-07-30  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/69867
	* decl.c (build_struct): Ensure that pointers point to something.

2016-07-30  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/69867
	* gfortran.dg/pr69867.f90: New test.

From-SVN: r238907
parent b441ae1d
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69867
* decl.c (build_struct): Ensure that pointers point to something.
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69962
* decl.c (gfc_set_constant_character_len): if expr is not
constant issue an error instead of an ICE.
......
......@@ -1926,7 +1926,9 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
if (c->initializer->expr_type == EXPR_CONSTANT)
gfc_set_constant_character_len (len, c->initializer, -1);
else if (mpz_cmp (c->ts.u.cl->length->value.integer,
else if (c->initializer
&& c->initializer->ts.u.cl
&& mpz_cmp (c->ts.u.cl->length->value.integer,
c->initializer->ts.u.cl->length->value.integer))
{
gfc_constructor *ctor;
......
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69867
* gfortran.dg/pr69867.f90: New test.
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69962
* gfortran.dg/pr69962.f90: New test.
......
! { dg-do compile }
program p
type t
character(1) :: c(1)=[1] ! { dg-error "convert INTEGER.4. to CHARACTER.1." }
end type
end
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