re PR fortran/85543 (ICE in update_current_proc_array_outer_dependency, at fortran...
authorSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 25 May 2018 00:39:23 +0000 (00:39 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 25 May 2018 00:39:23 +0000 (00:39 +0000)
2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/85543
* resolve.c (update_current_proc_array_outer_dependency): Avoid NULL
pointer dereference.

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

PR fortran/85543
* gfortran.dg/pr85543.f90: New test.

From-SVN: r260704

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

index 9410c52f8b6cddb5f905db9d62b7220bd9f0cec1..98fbfd1d50ae2508d7c258eeb2ad8d486021adf0 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85543
+       * resolve.c (update_current_proc_array_outer_dependency): Avoid NULL
+       pointer dereference.
+
 2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/85780
index 434c532257a5746c9e8d44c1e6bb19637f0c941f..43b1dedd2b266c564c408fbc811a4d6891e60477 100644 (file)
@@ -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;
 }
 
index fec1fca5d18bdf4d66699f0dfd9b8bf80819ef13..bdf5e846b090daab1873f50e8c1d3423f153b9c4 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85543
+       * gfortran.dg/pr85543.f90: New test.
+
 2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/85780
diff --git a/gcc/testsuite/gfortran.dg/pr85543.f90 b/gcc/testsuite/gfortran.dg/pr85543.f90
new file mode 100644 (file)
index 0000000..d3f8327
--- /dev/null
@@ -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