aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2019-09-13 11:33:18 +0000
committerBernd Edlinger <edlinger@gcc.gnu.org>2019-09-13 11:33:18 +0000
commit22cd031212e2376221435db5e9c6a298f24d7046 (patch)
tree1e57e5edf8dbc98fb09ef9e5ca11b32f313cd7c8 /gcc/fortran/trans-array.c
parent0d1cfeed7f7c5dbd3524fc64ab3f84dc4ed6ee17 (diff)
downloadgcc-22cd031212e2376221435db5e9c6a298f24d7046.zip
gcc-22cd031212e2376221435db5e9c6a298f24d7046.tar.gz
gcc-22cd031212e2376221435db5e9c6a298f24d7046.tar.bz2
re PR fortran/91716 (ICE in output_constant, at varasm.c:5026)
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. testsuite: 2019-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de> PR fortran/91716 * gfortran.dg/pr91716.f90: New test. From-SVN: r275698
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index da70301..8881fd9 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -6108,17 +6108,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;