]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/58754 (ICE on allocating character array with source)
authorPaul Thomas <pault@gcc.gnu.org>
Thu, 22 Oct 2015 18:08:31 +0000 (18:08 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Thu, 22 Oct 2015 18:08:31 +0000 (18:08 +0000)
2015-10-22  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/58754
* gfortran.dg/pr58754.f90: New test

From-SVN: r229180

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr58754.f90 [new file with mode: 0644]

index c08758f38afe0f73a51fd727822ea1998ca7fcb2..3c81539b880bd9788ed86b1ed0b4ec5e61846861 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-22  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/58754
+       * gfortran.dg/pr58754.f90: New test
+
 2013-10-19  Paul Thomas  <pault@gcc.gnu.org>
 
        Backport from trunk
diff --git a/gcc/testsuite/gfortran.dg/pr58754.f90 b/gcc/testsuite/gfortran.dg/pr58754.f90
new file mode 100644 (file)
index 0000000..a366985
--- /dev/null
@@ -0,0 +1,24 @@
+! { dg-do compile }
+!
+! Tests the fix for PR58754
+!
+  type :: char_type
+    character, allocatable :: chr (:)
+  end type
+  character, allocatable :: c(:)
+  type(char_type) :: d
+  character :: t(1) = ["w"]
+
+  allocate (c (1), source = t)
+  if (any (c .ne. t)) call abort
+  c = ["a"]
+  if (any (c .ne. ["a"])) call abort
+  deallocate (c)
+
+! Check allocatable character components, whilst we are about it.
+  allocate (d%chr (2), source = [t, char (ichar (t) + 1)])
+  if (any (d%chr .ne. ["w", "x"])) call abort
+  d%chr = ["a","b","c","d"]
+  if (any (d%chr .ne. ["a","b","c","d"])) call abort
+  deallocate (d%chr)
+end