Commit 36f972b7 by Steven G. Kargl

re PR fortran/88025 (ICE in gfc_apply_init, at fortran/expr.c:4468)

2018-12-08  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/88025
	* expr.c (gfc_apply_init):  Remove asserts that cannot trigger.
	Check for a NULL pointer.

2018-12-08  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/88025
	* gfortran.dg/pr88025.f90: New test.

From-SVN: r266913
parent 2bf27f6b
2018-12-08 Steven G. Kargl <kargl@gcc.gnu.org> 2018-12-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/88025
* expr.c (gfc_apply_init): Remove asserts that cannot trigger.
Check for a NULL pointer.
2018-12-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/88357 PR fortran/88357
* class.c (insert_component_ref): Check for NULL pointer and * class.c (insert_component_ref): Check for NULL pointer and
previous error message issued. previous error message issued.
......
...@@ -4485,12 +4485,10 @@ gfc_apply_init (gfc_typespec *ts, symbol_attribute *attr, gfc_expr *init) ...@@ -4485,12 +4485,10 @@ gfc_apply_init (gfc_typespec *ts, symbol_attribute *attr, gfc_expr *init)
{ {
if (ts->type == BT_CHARACTER && !attr->pointer && init if (ts->type == BT_CHARACTER && !attr->pointer && init
&& ts->u.cl && ts->u.cl
&& ts->u.cl->length && ts->u.cl->length->expr_type == EXPR_CONSTANT) && ts->u.cl->length
&& ts->u.cl->length->expr_type == EXPR_CONSTANT
&& ts->u.cl->length->ts.type == BT_INTEGER)
{ {
gcc_assert (ts->u.cl && ts->u.cl->length);
gcc_assert (ts->u.cl->length->expr_type == EXPR_CONSTANT);
gcc_assert (ts->u.cl->length->ts.type == BT_INTEGER);
HOST_WIDE_INT len = gfc_mpz_get_hwi (ts->u.cl->length->value.integer); HOST_WIDE_INT len = gfc_mpz_get_hwi (ts->u.cl->length->value.integer);
if (init->expr_type == EXPR_CONSTANT) if (init->expr_type == EXPR_CONSTANT)
......
2018-12-08 Steven G. Kargl <kargl@gcc.gnu.org> 2018-12-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/88025
* gfortran.dg/pr88025.f90: New test.
2018-12-08 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/pr88357_1.f90: New test. * gfortran.dg/pr88357_1.f90: New test.
* gfortran.dg/pr88357_2.f90: New test. * gfortran.dg/pr88357_2.f90: New test.
......
! { dg-do compile }
! PR fortran/88025
program p
type t
character(('')) :: c = 'c' ! { dg-error "must be of INTEGER type" }
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