From: Steven G. Kargl Date: Fri, 11 May 2018 18:58:21 +0000 (+0000) Subject: re PR fortran/85542 (ICE in check_inquiry, at fortran/expr.c:2426) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8132af9db3e2bf5a4f39cb48b6e3fd8f4045ec9f;p=gcc.git re PR fortran/85542 (ICE in check_inquiry, at fortran/expr.c:2426) 2018-05-11 Steven G. Kargl PR fortran/85542 * expr.c (check_inquiry): Avoid NULL pointer dereference. 2018-05-11 Steven G. Kargl PR fortran/85542 * gfortran.dg/pr85542.f90: New test. From-SVN: r260182 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 03dbc626c92..e603fef4f3f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2018-05-11 Steven G. Kargl + + PR fortran/85542 + * expr.c (check_inquiry): Avoid NULL pointer dereference. + 2018-05-10 Steven G. Kargl PR fortran/85687 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 9e113d26a59..e6ab82272f1 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2422,7 +2422,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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 90bda6e9507..ddcba1fd220 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-05-11 Steven G. Kargl + + PR fortran/85542 + * gfortran.dg/pr85542.f90: New test. + 2018-05-11 Martin Jambor PR ipa/85655 diff --git a/gcc/testsuite/gfortran.dg/pr85542.f90 b/gcc/testsuite/gfortran.dg/pr85542.f90 new file mode 100644 index 00000000000..f61d2c9beb0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr85542.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR fortran/85542 +function f(x) + character(*), intent(in) :: x + character((len((x)))) :: f + f = x +end