re PR fortran/32928 (DATA statement with array element as initializer is rejected)

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

From-SVN: r130487
This commit is contained in:
Jerry DeLisle 2007-11-28 01:12:31 +00:00
parent a27369a518
commit 08203c44a3
5 changed files with 44 additions and 0 deletions

View file

@ -1,3 +1,11 @@
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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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