From fd5dce5c53117501297c17a4e092a13009d2c119 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Wed, 8 Nov 2017 20:56:43 +0000 Subject: [PATCH] re PR fortran/82884 (ICE in gfc_resolve_character_array_constructor, at fortran/array.c:2069) 2017-11-08 Steven G. Kargl PR fortran/82884 * arith.c (gfc_hollerith2character): Clear pad. 2017-11-08 Steven G. Kargl PR fortran/82884 * gfortran.dg/hollerith_character_array_constructor.f90: New test. From-SVN: r254553 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/arith.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ .../hollerith_character_array_constructor.f90 | 11 +++++++++++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/hollerith_character_array_constructor.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8de4c1b9833..b554f9f7937 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2017-11-08 Steven G. Kargl + + PR fortran/82884 + * arith.c (gfc_hollerith2character): Clear pad. + 2017-11-08 Janne Blomqvist PR 82869 diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index c3be14df522..3c75895e2ef 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -2604,6 +2604,7 @@ gfc_hollerith2character (gfc_expr *src, int kind) result = gfc_copy_expr (src); result->ts.type = BT_CHARACTER; result->ts.kind = kind; + result->ts.u.pad = 0; result->value.character.length = result->representation.length; result->value.character.string diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d20cadc2323..475cc27b3c8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-11-08 Steven G. Kargl + + PR fortran/82884 + * gfortran.dg/hollerith_character_array_constructor.f90: New test. + 2017-11-08 Kyrylo Tkachov * gcc.target/aarch64/store_v2vec_lanes.c: New test. diff --git a/gcc/testsuite/gfortran.dg/hollerith_character_array_constructor.f90 b/gcc/testsuite/gfortran.dg/hollerith_character_array_constructor.f90 new file mode 100644 index 00000000000..086d46efc2e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/hollerith_character_array_constructor.f90 @@ -0,0 +1,11 @@ +! { dg-do run } +! { dg-options "-w" } +! PR fortran/82884 +! Original code contributed by Gerhard Steinmetz +program p + character :: c(4) = [1h(, 1hi, 1h4, 1h)] + if (c(1) /= '(') call abort + if (c(2) /= 'i') call abort + if (c(3) /= '4') call abort + if (c(4) /= ')') call abort +end -- 2.30.2