re PR fortran/66347 (Seg fault (ICE) on compile)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 5 Jun 2015 23:01:22 +0000 (23:01 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 5 Jun 2015 23:01:22 +0000 (23:01 +0000)
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.

From-SVN: r224175

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

index 35d3ce67be9e9c94cd837863fa818dbbd6135dac..6b5a1e57862754c4abfe7b71989ee8dbb5631eea 100644 (file)
@@ -1,3 +1,9 @@
+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  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/66385
index e615cc6dfb24634b1c2136b6edf52d65bd28e33d..52dc10949e671047d38c10f9085ced798146fdaa 100644 (file)
@@ -10949,7 +10949,7 @@ apply_default_init_local (gfc_symbol *sym)
      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 e1a415ae5cd0653d6f3cb4db6b3cb9a7f453d7c4..dde4c8c0cfd9cdcd13f7a15e947a6ba491d6657f 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-05  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/66347
+       * gfortran.dg/blockdata_9.f: New test.
+
 2015-06-05  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/66385
diff --git a/gcc/testsuite/gfortran.dg/blockdata_9.f b/gcc/testsuite/gfortran.dg/blockdata_9.f
new file mode 100644 (file)
index 0000000..52b513e
--- /dev/null
@@ -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