]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/85542 (ICE in check_inquiry, at fortran/expr.c:2426)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 12 May 2018 16:57:28 +0000 (16:57 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 12 May 2018 16:57:28 +0000 (16:57 +0000)
2018-05-12  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/85542
Backport from trunk
* expr.c (check_inquiry): Avoid NULL pointer dereference.

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

PR fortran/85542
Backport from trunk
* gfortran.dg/pr85542.f90: New test.

From-SVN: r260197

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

index 6e1ef1b37e5e73bf65960ede2dfe034734dd6728..ebb21479d07433acb675d6f8f0455234f28c3537 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-12  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85542
+       Backport from trunk
+       * expr.c (check_inquiry): Avoid NULL pointer dereference.
 2018-05-12  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/68846
index f302ef70b8649429170f40acadff912af629af88..e890c4b2861a127d2cac56b5f76eeb4f40eaf1e5 100644 (file)
@@ -2315,7 +2315,7 @@ check_inquiry (gfc_expr *e, int not_restricted)
 
        /* Assumed character length will not reduce to a constant expression
           with LEN, as required by the standard.  */
-       if (i == 5 && not_restricted
+       if (i == 5 && not_restricted && ap->expr->symtree
            && ap->expr->symtree->n.sym->ts.type == BT_CHARACTER
            && (ap->expr->symtree->n.sym->ts.u.cl->length == NULL
                || ap->expr->symtree->n.sym->ts.deferred))
index 7e28aef22f35e3c08503a9ec6bf4392145c58ccc..7610ddb10d6c2dfa305b8f5f9f6cd2c3c3b4de8d 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-12  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85542
+       Backport from trunk
+       * gfortran.dg/pr85542.f90: New test.
+
 2018-05-12  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/68846
diff --git a/gcc/testsuite/gfortran.dg/pr85542.f90 b/gcc/testsuite/gfortran.dg/pr85542.f90
new file mode 100644 (file)
index 0000000..f61d2c9
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/85542
+function f(x)
+   character(*), intent(in) :: x
+   character((len((x)))) :: f
+   f = x
+end