From: Steven G. Kargl Date: Sun, 9 Dec 2018 01:02:41 +0000 (+0000) Subject: re PR fortran/88025 (ICE in gfc_apply_init, at fortran/expr.c:4468) X-Git-Tag: basepoints/gcc-10~2467 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=36f972b713ddf335067475c954d2bed3173ceba9;p=thirdparty%2Fgcc.git re PR fortran/88025 (ICE in gfc_apply_init, at fortran/expr.c:4468) 2018-12-08 Steven G. Kargl PR fortran/88025 * expr.c (gfc_apply_init): Remove asserts that cannot trigger. Check for a NULL pointer. 2018-12-08 Steven G. Kargl PR fortran/88025 * gfortran.dg/pr88025.f90: New test. From-SVN: r266913 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8603e431f73f..478372432561 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-12-08 Steven G. Kargl + + PR fortran/88025 + * expr.c (gfc_apply_init): Remove asserts that cannot trigger. + Check for a NULL pointer. + 2018-12-08 Steven G. Kargl PR fortran/88357 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 388fddab4729..6cea5b07393c 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4485,12 +4485,10 @@ gfc_apply_init (gfc_typespec *ts, symbol_attribute *attr, gfc_expr *init) { if (ts->type == BT_CHARACTER && !attr->pointer && init && 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); if (init->expr_type == EXPR_CONSTANT) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f4a7885e0af7..28a3e7db440c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-08 Steven G. Kargl + + PR fortran/88025 + * gfortran.dg/pr88025.f90: New test. + 2018-12-08 Steven G. Kargl * gfortran.dg/pr88357_1.f90: New test. diff --git a/gcc/testsuite/gfortran.dg/pr88025.f90 b/gcc/testsuite/gfortran.dg/pr88025.f90 new file mode 100644 index 000000000000..96172fae76a5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr88025.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR fortran/88025 +program p + type t + character(('')) :: c = 'c' ! { dg-error "must be of INTEGER type" } + end type +end