From: Paul Thomas Date: Thu, 22 Oct 2015 18:08:31 +0000 (+0000) Subject: re PR fortran/58754 (ICE on allocating character array with source) X-Git-Tag: releases/gcc-4.9.4~545 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d570073e45bd10c8ab3981b2aa10a3aa9ce9d83;p=thirdparty%2Fgcc.git re PR fortran/58754 (ICE on allocating character array with source) 2015-10-22 Paul Thomas PR fortran/58754 * gfortran.dg/pr58754.f90: New test From-SVN: r229180 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c08758f38afe..3c81539b880b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-22 Paul Thomas + + PR fortran/58754 + * gfortran.dg/pr58754.f90: New test + 2013-10-19 Paul Thomas Backport from trunk diff --git a/gcc/testsuite/gfortran.dg/pr58754.f90 b/gcc/testsuite/gfortran.dg/pr58754.f90 new file mode 100644 index 000000000000..a3669856347b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr58754.f90 @@ -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