[gcc/devel/omp/gcc-9] backport: re PR fortran/91716 (ICE in output_constant, at varasm.c:5026)
Tobias Burnus
burnus@gcc.gnu.org
Thu Mar 5 14:06:00 GMT 2020
https://gcc.gnu.org/g:091421018c0d22c4319830d2dbc2fd778d1cc778
commit 091421018c0d22c4319830d2dbc2fd778d1cc778
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Wed Oct 2 13:22:37 2019 +0000
backport: re PR fortran/91716 (ICE in output_constant, at varasm.c:5026)
2019-10-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
Backport from mainline
2019-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR fortran/91716
* trans-array.c (gfc_conv_array_initializer): Always assign the
array type of the field to the string constant.
PR fortran/91716
* gfortran.dg/pr91716.f90: New test.
From-SVN: r276458
Diff:
---
gcc/ChangeLog | 10 ++++++++++
gcc/fortran/trans-array.c | 11 +++++++----
gcc/testsuite/ChangeLog | 9 +++++++++
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b360971..1e9c050 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2019-10-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ Backport from mainline
+
+ 2019-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR fortran/91716
+ * trans-array.c (gfc_conv_array_initializer): Always assign the
+ array type of the field to the string constant.
+
2019-10-01 Oleg Endo <olegendo@gcc.gnu.org>
Backport from mainline
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 583425c..9e1f159 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -6110,17 +6110,20 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr)
tree atype = type;
while (TREE_CODE (TREE_TYPE (atype)) == ARRAY_TYPE)
atype = TREE_TYPE (atype);
- if (TREE_CODE (TREE_TYPE (atype)) == INTEGER_TYPE
- && tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (se.expr)))
- > tree_to_uhwi (TYPE_SIZE_UNIT (atype)))
+ gcc_checking_assert (TREE_CODE (TREE_TYPE (atype))
+ == INTEGER_TYPE);
+ gcc_checking_assert (TREE_TYPE (TREE_TYPE (se.expr))
+ == TREE_TYPE (atype));
+ if (tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (se.expr)))
+ > tree_to_uhwi (TYPE_SIZE_UNIT (atype)))
{
unsigned HOST_WIDE_INT size
= tree_to_uhwi (TYPE_SIZE_UNIT (atype));
const char *p = TREE_STRING_POINTER (se.expr);
se.expr = build_string (size, p);
- TREE_TYPE (se.expr) = atype;
}
+ TREE_TYPE (se.expr) = atype;
}
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f6095ab..362ed17 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2019-10-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ Backport from mainline
+
+ 2019-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR fortran/91716
+ * gfortran.dg/pr91716.f90: New test.
+
2019-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91864
More information about the Gcc-cvs
mailing list