brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 7ca514e Raw
59 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! DATA statement errors3subroutine s14  type :: t15    integer :: j = 6666  end type t17  type(t1) :: t1x8  !ERROR: Default-initialized 't1x' must not be initialized in a DATA statement9  data t1x%j / 777 /10  type :: t211    integer, allocatable :: j12    integer :: k13  end type t214  type(t2) :: t2x15  data t2x%k / 777 / ! allocatable component is ok16  integer :: ja = 88817  !ERROR: Default-initialized 'ja' must not be initialized in a DATA statement18  data ja / 999 /19  integer :: a1(10)20  !ERROR: DATA statement set has more values than objects21  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 zero27  data (a3(j),j=1,2,0)/2*333/28  integer :: a4(3)29  !ERROR: DATA statement designator 'a4(5_8)' is out of range30  data (a4(j),j=1,5,2) /3*222/31  integer :: a5(3)32  !ERROR: DATA statement designator 'a5(-2_8)' is out of range33  data       a5(-2) / 1 /34  interface35    real function rfunc(x)36      real, intent(in) :: x37    end function38  end interface39  real, pointer :: rp40  !ERROR: Procedure 'rfunc' may not be used to initialize 'rp', which is not a procedure pointer41  data rp/rfunc/42  procedure(rfunc), pointer :: rpp43  real, target :: rt44  !WARNING: Procedure pointer 'rpp' in a DATA statement is not standard [-Wdata-stmt-extensions]45  !ERROR: Data object 'rt' may not be used to initialize 'rpp', which is a procedure pointer46  data rpp/rt/47  !ERROR: Initializer for 'rt' must not be a pointer48  data rt/null()/49  !ERROR: Initializer for 'rt' must not be a procedure50  data rt/rfunc/51  integer :: jx, jy52  !WARNING: DATA statement value initializes 'jx' of type 'INTEGER(4)' with CHARACTER [-Wdata-stmt-extensions]53  data jx/'abc'/54  !ERROR: DATA statement value could not be converted to the type 'INTEGER(4)' of the object 'jx'55  data jx/t1()/56  !ERROR: DATA statement value 'jy' for 'jx' is not a constant57  data jx/jy/58end subroutine59