public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [Committed] PR fortran/85543 -- Avoid NULL pointer
@ 2018-05-25  0:40 Steve Kargl
  0 siblings, 0 replies; only message in thread
From: Steve Kargl @ 2018-05-25  0:40 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

Committed as obvious.

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.

-- 
Steve

[-- Attachment #2: pr85543.diff --]
[-- Type: text/x-diff, Size: 1080 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-25  0:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-25  0:40 [Committed] PR fortran/85543 -- Avoid NULL pointer Steve Kargl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).