OSDN Git Service

2007-11-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Nov 2007 01:12:31 +0000 (01:12 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Nov 2007 01:12:31 +0000 (01:12 +0000)
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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130487 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/data_array_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/data_array_2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/data_array_3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/data_array_4.f90 [new file with mode: 0644]

index aaf029a..b8ee3a3 100644 (file)
@@ -1,5 +1,13 @@
 2007-11-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
+       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  <jvdelisle@gcc.gnu.org>
+
        PR fortran/34227
        * gfortran.dg/blockdata_5.f90: New test.
        * gfortran.dg/blockdata_6.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/data_array_1.f90 b/gcc/testsuite/gfortran.dg/data_array_1.f90
new file mode 100644 (file)
index 0000000..46c9a5b
--- /dev/null
@@ -0,0 +1,17 @@
+! { dg-do run }
+! PR32928 DATA statement with array element as initializer is rejected
+! Test case by Jerry DeLisle  <jvdelisle @gcc.gnu.org>
+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 (file)
index 0000000..20777a2
--- /dev/null
@@ -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 (file)
index 0000000..d9de791
--- /dev/null
@@ -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 (file)
index 0000000..3df3031
--- /dev/null
@@ -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