1! RUN: %python %S/test_errors.py %s %flang_fc1
2! DATA statement errors
3subroutine s1
4  type :: t1
5    integer :: j = 666
6  end type t1
7  type(t1) :: t1x
8  !ERROR: Default-initialized 't1x' must not be initialized in a DATA statement
9  data t1x%j / 777 /
10  type :: t2
11    integer, allocatable :: j
12    integer :: k
13  end type t2
14  type(t2) :: t2x
15  data t2x%k / 777 / ! allocatable component is ok
16  integer :: ja = 888
17  !ERROR: Default-initialized 'ja' must not be initialized in a DATA statement
18  data ja / 999 /
19  integer :: a1(10)
20  !ERROR: DATA statement set has more values than objects
21  data a1(1:9:2) / 6 * 1 /
22  integer :: a2(10)
23  !ERROR: DATA statement set has no value for 'a2(2_8)'
24  data (a2(k),k=10,1,-2) / 4 * 1 /
25  integer :: a3(2)
26  !ERROR: DATA statement implied DO loop has a step value of zero
27  data (a3(j),j=1,2,0)/2*333/
28  integer :: a4(3)
29  !ERROR: DATA statement designator 'a4(5_8)' is out of range
30  data (a4(j),j=1,5,2) /3*222/
31  interface
32    real function rfunc(x)
33      real, intent(in) :: x
34    end function
35  end interface
36  real, pointer :: rp
37  !ERROR: Procedure 'rfunc' may not be used to initialize 'rp', which is not a procedure pointer
38  data rp/rfunc/
39  procedure(rfunc), pointer :: rpp
40  real, target :: rt
41  !ERROR: Data object 'rt' may not be used to initialize 'rpp', which is a procedure pointer
42  data rpp/rt/
43  !ERROR: Initializer for 'rt' must not be a pointer
44  data rt/null()/
45  !ERROR: Initializer for 'rt' must not be a procedure
46  data rt/rfunc/
47  integer :: jx, jy
48  !WARNING: DATA statement value initializes 'jx' of type 'INTEGER(4)' with CHARACTER
49  data jx/'abc'/
50  !ERROR: DATA statement value could not be converted to the type 'INTEGER(4)' of the object 'jx'
51  data jx/t1()/
52  !ERROR: DATA statement value 'jy' for 'jx' is not a constant
53  data jx/jy/
54end subroutine
55