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 /)
38 !ERROR: Data object must not be a coindexed variable
41 !ERROR: Data object must not be a coindexed variable
42 DATA(a
[i
], i
= 1, 5) / 5 * 1 /
44 !ERROR: Data object variable must not be a function reference
47 !ERROR: Data object must have constant subscripts
50 !ERROR: Data object must have constant subscripts
51 DATA name( : ind
) / 'Ancd' /
53 !ERROR: Data object must have constant subscripts
54 DATA name(ind
:) / 'Ancd' /
56 !ERROR: Data implied do object must be a variable
57 DATA(c(i
), i
= 1, 5) / 5 * 1 /
59 !ERROR: Data implied do object must be a variable
60 DATA(newNumsArray(i
), i
= 1, 2) &
61 / specialNumbers(1, 2 * (/ 1, 2, 3, 4, 5 /)) /
63 !ERROR: Data implied do structure component must be subscripted
64 DATA(nums
% one
, i
= 1, 5) / 5 * 1 /
66 !ERROR: Data implied do object must be a variable
67 DATA(newNums
% numbers(i
), i
= 1, 5) / 5 * 1 /
69 !ERROR: Data implied do object must be a variable
70 DATA(newNumsArray(i
) % one
, i
= 1, 5) / 5 * 1 /
73 DATA(largeArray(j
) % nums
% one
, j
= 1, 5) / 5 * 1 /
76 DATA(largeNumber
% numsArray(j
) % one
, j
= 1, 5) / 5 * 1 /
78 !ERROR: Data object must have constant subscripts
79 DATA(b(x
), i
= 1, 5) / 5 * 1 /
82 DATA(nums
% numbers(i
), i
= 1, 5) / 5 * 1 /
85 DATA((d(i
, j
), i
= 1, 10), j
= 1, 10) / 100 * 1 /
88 DATA(d(i
, 1), i
= 1, 10) / 10 * 1 /