From: Steven G. Kargl Date: Wed, 18 Nov 2015 22:55:17 +0000 (+0000) Subject: re PR fortran/59910 (ICE in gfc_conv_array_initializer, at fortran/trans-array.c... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=586dc38b3e73adcec9cb87874ee06911bcceed9a;p=gcc.git re PR fortran/59910 (ICE in gfc_conv_array_initializer, at fortran/trans-array.c:5327) 2015-11-18 Steven G. Kargl PR fortran/59910 * primary.c (gfc_match_structure_constructor): Reduce a structure constructor in a DATA statement. 2015-11-18 Steven G. Kargl PR fortran/59910 * gfortran.dg/pr59910.f90: New test. From-SVN: r230580 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5e10387b8a0..3bd9743468f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-11-18 Steven G. Kargl + + PR fortran/59910 + * primary.c (gfc_match_structure_constructor): Reduce a structure + constructor in a DATA statement. + 2015-11-18 Steven G. Kargl PR fortran/43996 diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index d1c17f00fee..841e9e18287 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2722,6 +2722,12 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result) return MATCH_ERROR; } + /* If a structure constructor is in a DATA statement, then each entity + in the structure constructor must be a constant. Try to reduce the + expression here. */ + if (gfc_in_match_data ()) + gfc_reduce_init_expr (e); + *result = e; return MATCH_YES; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b820e136246..8109c33cb4b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-18 Steven G. Kargl + + PR fortran/59910 + * gfortran.dg/pr59910.f90: New test. + 2015-11-18 Steven G. Kargl PR fortran/43996 diff --git a/gcc/testsuite/gfortran.dg/pr59910.f90 b/gcc/testsuite/gfortran.dg/pr59910.f90 new file mode 100644 index 00000000000..2b288e4ff6c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr59910.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! PR fortran/59910 +! +program main + implicit none + type bar + integer :: limit(1) + end type + type (bar) :: testsuite + data testsuite / bar(reshape(source=[10],shape=[1])) / +end