]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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 19:24:06 +0000 (19:24 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 25 May 2018 19:24:06 +0000 (19:24 +0000)
2018-05-25  Steven G. Kargl  <kargl@gcc.gnu.org>

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

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

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

From-SVN: r260774

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

index 8b59be6f02c3150225624f8d23a6b780a143dd55..846cd947393caccec705614a3a7c77c92668a660 100644 (file)
@@ -1,3 +1,10 @@
+2018-05-25  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85543
+       Backport from trunk
+       * resolve.c (update_current_proc_array_outer_dependency): Avoid NULL
+       pointer dereference.
+
 2018-05-25  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/85779
index fa839ba98e614313212d8870f465501e4ef0ce7f..3246d7b2c6cb2c9ce5c1d619e2af91ca5eaf7cd8 100644 (file)
@@ -2906,8 +2906,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 4ed6faf2e86d41af8477b85f34c26159be87db51..f7a33f936b196732b2ddf57c455d010fcd022a51 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-25  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85543
+       Backport from trunk
+       * gfortran.dg/pr85543.f90: New test.
+
 2018-05-25  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/85779
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