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 8de4c1b98334cc125f0155114a4d651486489877..b554f9f7937576db5c2f7acc5885d93c36332710 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 c3be14df522d1d4cbf3e07881f5618154b15fb44..3c75895e2efd1f9254b94dc112554f99514b7b4e 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 d20cadc232376ffff70cc96a046a5595cd03e04b..475cc27b3c82726eb9c5d18b04060943b5480bcb 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