]> 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:38:11 +0000 (19:38 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 25 May 2018 19:38:11 +0000 (19:38 +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: r260775

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

index 88c80c97243b1206b0cc32835e89989ebc8f381d..caffbd21a157f2d6eb89cb6620d3fbac35f231f0 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-16  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/83149
index 0285089ef0e4beb7afadcb574bcd5891e955137d..001705b1bb702279f633c24ff86c0dcd1aa230e1 100644 (file)
@@ -2899,8 +2899,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 79ce1b61f5e7d294a703afe23f09b00898d0a269..d15a73cc2033b2e1c17d5de0c5e842ff208ca5a5 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-24  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/avx512f-vcvtusi2sd64-1.c: Update scan string.
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