re PR fortran/41807 (data statement with nested type constructors)
2009-11-21 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/41807 * gfortran.dg/data_value_1.f90: Update test. * gfortran.dg/array_constructor_32.f90: New test. From-SVN: r154419
This commit is contained in:
parent
9d3d3f1078
commit
27bcaf0476
@ -1,3 +1,9 @@
|
||||
2009-11-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR fortran/41807
|
||||
* gfortran.dg/data_value_1.f90: Update test.
|
||||
* gfortran.dg/array_constructor_32.f90: New test.
|
||||
|
||||
2009-11-21 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
PR middle-end/42025
|
||||
|
28
gcc/testsuite/gfortran.dg/array_constructor_32.f90
Normal file
28
gcc/testsuite/gfortran.dg/array_constructor_32.f90
Normal file
@ -0,0 +1,28 @@
|
||||
! { dg-do run }
|
||||
! PR41807 data statement with nested type constructors
|
||||
! Test case provided by Steve Kargl
|
||||
implicit none
|
||||
|
||||
type :: a
|
||||
real :: x(3)
|
||||
end type a
|
||||
|
||||
integer, parameter :: n = 3
|
||||
|
||||
type(a) :: b(n)
|
||||
|
||||
real, parameter :: d1(3) = (/1., 2., 3./)
|
||||
real, parameter :: d2(3) = (/4., 5., 6./)
|
||||
real, parameter :: d3(3) = (/7., 8., 9./)
|
||||
|
||||
integer :: i, z(n)
|
||||
|
||||
data (b(i), i = 1, n) /a(d1), a(d2), a(d3)/
|
||||
data (z(i), i = 1, n) / 1, 2, 3/
|
||||
|
||||
if (any(z.ne.[1, 2, 3])) call abort
|
||||
if (any(b(1)%x.ne.[1, 2, 3]) .or. &
|
||||
any(b(2)%x.ne.[4, 5, 6]) .or. &
|
||||
any(b(3)%x.ne.[7, 8, 9])) call abort
|
||||
end
|
||||
|
@ -3,12 +3,14 @@
|
||||
! is not a constant and so the DATA statement did not have
|
||||
! a constant value expression.
|
||||
!
|
||||
! Modified dg-error for PR41807
|
||||
!
|
||||
! Contributed by Philippe Marguinaud <philippe.marguinaud@meteo.fr>
|
||||
!
|
||||
TYPE POINT
|
||||
REAL :: X
|
||||
ENDTYPE
|
||||
TYPE(POINT) :: P
|
||||
DATA P / POINT(1.+X) / ! { dg-error "non-constant DATA value" }
|
||||
DATA P / POINT(1.+X) / ! { dg-error "non-constant initialization" }
|
||||
print *, p
|
||||
END
|
||||
|
Loading…
x
Reference in New Issue
Block a user