From d012125dd7ae84f5c87120e6a66c1b0610199f09 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Fri, 5 Jun 2015 23:01:22 +0000 Subject: [PATCH] re PR fortran/66347 (Seg fault (ICE) on compile) 2015-06-05 Steven G. Kargl PR fortran/66347 * resolve.c (apply_default_init_local): Do not dereference a NULL pointer. 2015-06-05 Steven G. Kargl PR fortran/66347 * gfortran.dg/blockdata_9.f: New test. From-SVN: r224175 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/resolve.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/blockdata_9.f | 13 +++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/blockdata_9.f diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 35d3ce67be9..6b5a1e57862 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-06-05 Steven G. Kargl + + PR fortran/66347 + * resolve.c (apply_default_init_local): Do not dereference a NULL + pointer. + 2015-06-05 Thomas Koenig PR fortran/66385 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index e615cc6dfb2..52dc10949e6 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -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! */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e1a415ae5cd..dde4c8c0cfd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-05 Steven G. Kargl + + PR fortran/66347 + * gfortran.dg/blockdata_9.f: New test. + 2015-06-05 Thomas Koenig 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 index 00000000000..52b513e9f46 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/blockdata_9.f @@ -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 -- 2.30.2