From: Jerry DeLisle Date: Wed, 28 Nov 2007 01:12:31 +0000 (+0000) Subject: re PR fortran/32928 (DATA statement with array element as initializer is rejected) X-Git-Tag: releases/gcc-4.3.0~1292 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08203c44a36583c34b12551d1d7f7a2429b6fb2c;p=thirdparty%2Fgcc.git re PR fortran/32928 (DATA statement with array element as initializer is rejected) 2007-11-27 Jerry DeLisle PR fortran/32928 * gfortran.dg/data_array_1.f90 * gfortran.dg/data_array_2.f90 * gfortran.dg/data_array_3.f90 * gfortran.dg/data_array_4.f90 From-SVN: r130487 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aaf029aa8237..b8ee3a3a7da8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2007-11-27 Jerry DeLisle + + PR fortran/32928 + * gfortran.dg/data_array_1.f90 + * gfortran.dg/data_array_2.f90 + * gfortran.dg/data_array_3.f90 + * gfortran.dg/data_array_4.f90 + 2007-11-27 Jerry DeLisle PR fortran/34227 diff --git a/gcc/testsuite/gfortran.dg/data_array_1.f90 b/gcc/testsuite/gfortran.dg/data_array_1.f90 new file mode 100644 index 000000000000..46c9a5bb7f9b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_array_1.f90 @@ -0,0 +1,17 @@ +! { dg-do run } +! PR32928 DATA statement with array element as initializer is rejected +! Test case by Jerry DeLisle +program chkdata + integer, parameter,dimension(4) :: myint = [ 4,3,2,1 ] + character(3), parameter, dimension(3) :: mychar = [ "abc", "def", "ghi" ] + character(50) :: buffer + integer :: a(5) + character(5) :: c(5) + data a(1:2) / myint(4), myint(2) / + data a(3:5) / myint(1), myint(3), myint(1) / + data c / mychar(1), mychar(2), mychar(3), mychar(1), mychar(2) / + buffer = "" + if (any(a.ne.[1,3,4,2,4])) call abort + write(buffer,'(5(a))')c + if (buffer.ne."abc def ghi abc def ") call abort +end program chkdata diff --git a/gcc/testsuite/gfortran.dg/data_array_2.f90 b/gcc/testsuite/gfortran.dg/data_array_2.f90 new file mode 100644 index 000000000000..20777a2a796b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_array_2.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! PR32928 DATA statement with array element as initializer is rejected +integer, parameter,dimension(4) :: myint = [ 4,3,2,1 ] +integer :: a(5) +data a(1:2) / myint(a(1)), myint(2) / ! { dg-error "Invalid initializer" } +end diff --git a/gcc/testsuite/gfortran.dg/data_array_3.f90 b/gcc/testsuite/gfortran.dg/data_array_3.f90 new file mode 100644 index 000000000000..d9de791b4053 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_array_3.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! PR32928 DATA statement with array element as initializer is rejected +integer, parameter,dimension(4) :: myint = [ 4,3,2,1 ] +integer :: a(5),b +data a(1:2) / myint(b), myint(2) / ! { dg-error "Invalid initializer" } +end diff --git a/gcc/testsuite/gfortran.dg/data_array_4.f90 b/gcc/testsuite/gfortran.dg/data_array_4.f90 new file mode 100644 index 000000000000..3df30317eba8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_array_4.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR32928 DATA statement with array element as initializer is rejected +IMPLICIT NONE +INTEGER , PARAMETER :: NTAB = 3 +REAL :: SR(NTAB) , SR3(NTAB) +DATA SR/NTAB*0.0/ , SR3/NTAB*0.0/ +end