]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/88025 (ICE in gfc_apply_init, at fortran/expr.c:4468)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 9 Dec 2018 01:02:41 +0000 (01:02 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 9 Dec 2018 01:02:41 +0000 (01:02 +0000)
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

gcc/fortran/ChangeLog
gcc/fortran/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr88025.f90 [new file with mode: 0644]

index 8603e431f73fd2944d36ff3f8f0c2bd3cf12b7b7..47837243256159484e3f530f117ff2e00b71e0f2 100644 (file)
@@ -1,3 +1,9 @@
+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
index 388fddab4729205ac897aa0da5b863ae24e8f950..6cea5b07393c16a4357f123d32c4ebef6ece4969 100644 (file)
@@ -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)
index f4a7885e0af7117bda80bc84711dcae78acc0f2a..28a3e7db440c70853c78ad5278aa300e41ab61c1 100644 (file)
@@ -1,3 +1,8 @@
+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.
diff --git a/gcc/testsuite/gfortran.dg/pr88025.f90 b/gcc/testsuite/gfortran.dg/pr88025.f90
new file mode 100644 (file)
index 0000000..96172fa
--- /dev/null
@@ -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