[PATCH, committed] PR fortran/66347

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Jun 5 23:03:00 GMT 2015


I've committed the following under and "obviously correct"
after regression testing completed without any new failures.

2015-06-05  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/66347
	* resolve.c (apply_default_init_local): Do not dereference a NULL
	pointer.

2015-06-05  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/66347
	* gfortran.dg/blockdata_9.f: New test.


Index: fortran/resolve.c
===================================================================
--- fortran/resolve.c	(revision 224174)
+++ fortran/resolve.c	(working copy)
@@ -10949,7 +10949,7 @@ apply_default_init_local (gfc_symbol *sy
      result variable, which are also nonstatic.  */
   if (sym->attr.save || sym->ns->save_all
       || (flag_max_stack_var_size == 0 && !sym->attr.result
-	  && !sym->ns->proc_name->attr.recursive
+	  && (sym->ns->proc_name && !sym->ns->proc_name->attr.recursive)
 	  && (!sym->attr.dimension || !is_non_constant_shape_array (sym))))
     {
       /* Don't clobber an existing initializer!  */
Index: testsuite/gfortran.dg/blockdata_9.f
===================================================================
--- testsuite/gfortran.dg/blockdata_9.f	(revision 0)
+++ testsuite/gfortran.dg/blockdata_9.f	(working copy)
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-fno-automatic -finit-local-zero" }
+! PR fortran/66347
+
+      block data
+      implicit none
+      integer i, n
+      parameter (n=1)
+      character*2 s1(n)
+      character*8 s2(n)
+      common /foo/ s1, s2
+      data (s1(i),s2(i),i=1,n)/"ab","12345678"/
+      end

-- 
Steve



More information about the Fortran mailing list