From: Steven G. Kargl Date: Fri, 25 May 2018 00:39:23 +0000 (+0000) Subject: re PR fortran/85543 (ICE in update_current_proc_array_outer_dependency, at fortran... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=55157d5ed6df9a8eacd0e39c12c97fe7222f1172;p=gcc.git re PR fortran/85543 (ICE in update_current_proc_array_outer_dependency, at fortran/resolve.c:3060) 2018-05-24 Steven G. Kargl PR fortran/85543 * resolve.c (update_current_proc_array_outer_dependency): Avoid NULL pointer dereference. 2018-05-24 Steven G. Kargl PR fortran/85543 * gfortran.dg/pr85543.f90: New test. From-SVN: r260704 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9410c52f8b6..98fbfd1d50a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-05-24 Steven G. Kargl + + PR fortran/85543 + * resolve.c (update_current_proc_array_outer_dependency): Avoid NULL + pointer dereference. + 2018-05-24 Steven G. Kargl PR fortran/85780 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 434c532257a..43b1dedd2b2 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -3055,8 +3055,8 @@ update_current_proc_array_outer_dependency (gfc_symbol *sym) /* If SYM has references to outer arrays, so has the procedure calling SYM. If SYM is a procedure pointer, we can assume the worst. */ - if (sym->attr.array_outer_dependency - || sym->attr.proc_pointer) + if ((sym->attr.array_outer_dependency || sym->attr.proc_pointer) + && gfc_current_ns->proc_name) gfc_current_ns->proc_name->attr.array_outer_dependency = 1; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fec1fca5d18..bdf5e846b09 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-05-24 Steven G. Kargl + + PR fortran/85543 + * gfortran.dg/pr85543.f90: New test. + 2018-05-24 Steven G. Kargl PR fortran/85780 diff --git a/gcc/testsuite/gfortran.dg/pr85543.f90 b/gcc/testsuite/gfortran.dg/pr85543.f90 new file mode 100644 index 00000000000..d3f83276a7f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr85543.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/85543 +program p + procedure(), pointer :: z +contains + real(z()) function f() ! { dg-error "in initialization expression at" } + end +end