Committed as obvious. 2018-05-24 Steven G. Kargl <ka...@gcc.gnu.org>
PR fortran/85543 * resolve.c (update_current_proc_array_outer_dependency): Avoid NULL pointer dereference. 2018-05-24 Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/85543 * gfortran.dg/pr85543.f90: New test. -- Steve
Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 260698) +++ gcc/fortran/resolve.c (working copy) @@ -3055,8 +3055,8 @@ update_current_proc_array_outer_dependency (gfc_symbol /* 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; } Index: gcc/testsuite/gfortran.dg/pr85543.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr85543.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr85543.f90 (working copy) @@ -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