1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 !Testing data constraints : C874 - C875, C878 - C881
4 integer, target
:: modarray(1)
7 integer, intent(in
) :: i
11 subroutine CheckObject
19 type(specialNumbers
) nums
20 type(specialNumbers
) numsArray(5)
22 type(specialNumbers
), parameter ::newNums
= &
23 specialNumbers(1, (/ 1, 2, 3, 4, 5 /))
24 type(specialNumbers
), parameter ::newNumsArray(2) = &
25 (/ SpecialNumbers(1, (/ 1, 2, 3, 4, 5 /)), &
26 SpecialNumbers(1, (/ 1, 2, 3,4, 5 /)) /)
27 type(specialNumbers
) nums
28 type(large
) largeArray(5)
29 type(large
) largeNumber
33 real, parameter:: c(5) = (/ 1, 2, 3, 4, 5 /)
37 !ERROR: Data statement object must be a variable
40 !ERROR: Data object must not be a coindexed variable
43 !ERROR: Data object must not be a coindexed variable
44 DATA(a
[i
], i
= 1, 5) / 5 * 1 /
46 !ERROR: Data object variable must not be a function reference
49 !ERROR: Data object must have constant subscripts
52 !ERROR: Data object must have constant subscripts
53 DATA name( : ind
) / 'Ancd' /
55 !ERROR: Data object must have constant subscripts
56 DATA name(ind
:) / 'Ancd' /
58 !ERROR: Data implied do object must be a variable
59 DATA(c(i
), i
= 1, 5) / 5 * 1 /
61 !ERROR: Data implied do object must be a variable
62 DATA(newNumsArray(i
), i
= 1, 2) &
63 / specialNumbers(1, 2 * (/ 1, 2, 3, 4, 5 /)) /
65 !ERROR: Data implied do structure component must be subscripted
66 DATA(nums
% one
, i
= 1, 5) / 5 * 1 /
68 !ERROR: Data implied do object must be a variable
69 DATA(newNums
% numbers(i
), i
= 1, 5) / 5 * 1 /
71 !ERROR: Data implied do object must be a variable
72 DATA(newNumsArray(i
) % one
, i
= 1, 5) / 5 * 1 /
75 DATA(largeArray(j
) % nums
% one
, j
= 1, 5) / 5 * 1 /
78 DATA(largeNumber
% numsArray(j
) % one
, j
= 1, 5) / 5 * 1 /
80 !ERROR: Data object must have constant subscripts
81 DATA(b(x
), i
= 1, 5) / 5 * 1 /
84 DATA(nums
% numbers(i
), i
= 1, 5) / 5 * 1 /
87 DATA((d(i
, j
), i
= 1, 10), j
= 1, 10) / 100 * 1 /
90 DATA(d(i
, 1), i
= 1, 10) / 10 * 1 /