diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2010-09-20 18:55:12 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2010-09-20 18:55:12 +0000 |
commit | 15c2ef5ad3e24b393be17bcea677d1972bfe0945 (patch) | |
tree | 4fefd5f0a20782b1864cb03958e075ea4d9de51c /gcc/testsuite/gfortran.dg | |
parent | abc88a0827e475e92a4e39dac93b5f4ca7407ea6 (diff) | |
download | gcc-15c2ef5ad3e24b393be17bcea677d1972bfe0945.zip gcc-15c2ef5ad3e24b393be17bcea677d1972bfe0945.tar.gz gcc-15c2ef5ad3e24b393be17bcea677d1972bfe0945.tar.bz2 |
re PR fortran/45081 (ICE in gfc_conv_array_initializer, at fortran/trans-array.c:4208)
2010-09-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/45081
* simplify.c (is_constant_array_expr): Allow structure array
elements as well as constants.
(gfc_simplify_pack, gfc_simplify_reshape, gfc_simplify_spread,
gfc_simplify_transpose, gfc_simplify_unpack): Copy the derived
type of source to the result.
2010-09-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/45081
* gfortran.dg/derived_array_intrinsics_1.f90 : New test.
From-SVN: r164448
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r-- | gcc/testsuite/gfortran.dg/derived_array_intrinisics_1.f90 | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/derived_array_intrinisics_1.f90 b/gcc/testsuite/gfortran.dg/derived_array_intrinisics_1.f90 new file mode 100644 index 0000000..07d8985 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/derived_array_intrinisics_1.f90 @@ -0,0 +1,30 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! Test the fix for PR45081 in which derived type array valued intrinsics failed +! to simplify, which caused an ICE in trans-array.c +! +! Contributed by Thorsten Ohl <ohl@physik.uni-wuerzburg.de> +! + module m + implicit none + integer :: i + type t + integer :: i + end type t + type(t), dimension(4), parameter :: t1 = [( t(i), i = 1, 4)] + type(t), dimension(4), parameter :: t2 = [( t(i), i = 8, 11)] + type(t), dimension(2,2), parameter :: a = reshape ( t1, [ 2, 2 ] ) + type(t), dimension(2,2), parameter :: b = transpose (a) + type(t), dimension(4), parameter :: c = reshape ( b, [ 4 ] ) + type(t), dimension(2), parameter :: d = pack ( c, [.false.,.true.,.false.,.true.]) + type(t), dimension(4), parameter :: e = unpack (d, [.false.,.true.,.false.,.true.], t2) + type(t), dimension(4,2), parameter :: f = spread (e, 2, 2) + type(t), dimension(8), parameter :: g = reshape ( f, [ 8 ] ) + integer, parameter :: total = sum(g%i) + end module m + + use m + integer :: j + j = total + end +! { dg-final { scan-tree-dump-times "j = 50" 1 "original" } } |