re PR fortran/82884 (ICE in gfc_resolve_character_array_constructor, at fortran/array...
authorSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 8 Nov 2017 20:56:43 +0000 (20:56 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 8 Nov 2017 20:56:43 +0000 (20:56 +0000)
2017-11-08  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/82884
* arith.c (gfc_hollerith2character): Clear pad.

2017-11-08  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/82884
* gfortran.dg/hollerith_character_array_constructor.f90: New test.

From-SVN: r254553

gcc/fortran/ChangeLog
gcc/fortran/arith.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/hollerith_character_array_constructor.f90 [new file with mode: 0644]

index 8de4c1b..b554f9f 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-08  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/82884
+       * arith.c (gfc_hollerith2character): Clear pad.
+
 2017-11-08  Janne Blomqvist  <jb@gcc.gnu.org>
 
        PR 82869
index c3be14d..3c75895 100644 (file)
@@ -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
index d20cadc..475cc27 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-08  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/82884
+       * gfortran.dg/hollerith_character_array_constructor.f90: New test.
+
 2017-11-08  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * 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 (file)
index 0000000..086d46e
--- /dev/null
@@ -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