aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2015-11-18 22:55:17 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2015-11-18 22:55:17 +0000
commit586dc38b3e73adcec9cb87874ee06911bcceed9a (patch)
tree1a4887980cb1965c426ca7e3018bc017d9b8f709 /gcc
parent9231aa17d6498905234d8e35216b324a1b067c8c (diff)
downloadgcc-586dc38b3e73adcec9cb87874ee06911bcceed9a.zip
gcc-586dc38b3e73adcec9cb87874ee06911bcceed9a.tar.gz
gcc-586dc38b3e73adcec9cb87874ee06911bcceed9a.tar.bz2
re PR fortran/59910 (ICE in gfc_conv_array_initializer, at fortran/trans-array.c:5327)
2015-11-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/59910 * primary.c (gfc_match_structure_constructor): Reduce a structure constructor in a DATA statement. 2015-11-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/59910 * gfortran.dg/pr59910.f90: New test. From-SVN: r230580
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/primary.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr59910.f9011
4 files changed, 28 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 5e10387..3bd9743 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
2015-11-18 Steven G. Kargl <kargl@gcc.gnu.org>
+ PR fortran/59910
+ * primary.c (gfc_match_structure_constructor): Reduce a structure
+ constructor in a DATA statement.
+
+2015-11-18 Steven G. Kargl <kargl@gcc.gnu.org>
+
PR fortran/43996
* simplify.c (gfc_simplify_spread): Issue error for too large array
constructor in a PARAMETER statement.
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index d1c17f0..841e9e1 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 b820e13..8109c33 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2015-11-18 Steven G. Kargl <kargl@gcc.gnu.org>
+ PR fortran/59910
+ * gfortran.dg/pr59910.f90: New test.
+
+2015-11-18 Steven G. Kargl <kargl@gcc.gnu.org>
+
PR fortran/43996
* gfortran.dg/pr43996.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr59910.f90 b/gcc/testsuite/gfortran.dg/pr59910.f90
new file mode 100644
index 0000000..2b288e4
--- /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