data03.f90
2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
! RUN: %S/test_errors.sh %s %t %f18
!Testing data constraints : C874 - C875, C878 - C881
module m
integer, target :: modarray(1)
contains
function f(i)
integer, intent(in) :: i
integer, pointer :: f
f => modarray(i)
end
subroutine CheckObject
type specialNumbers
integer one
integer numbers(5)
end type
type large
integer elt(10)
integer val
type(specialNumbers) nums
type(specialNumbers) numsArray(5)
end type
type(specialNumbers), parameter ::newNums = &
specialNumbers(1, (/ 1, 2, 3, 4, 5 /))
type(specialNumbers), parameter ::newNumsArray(2) = &
(/ SpecialNumbers(1, (/ 1, 2, 3, 4, 5 /)), &
SpecialNumbers(1, (/ 1, 2, 3,4, 5 /)) /)
type(specialNumbers) nums
type(large) largeArray(5)
type(large) largeNumber
real :: a[*]
real :: b(5)
integer :: x
real, parameter:: c(5) = (/ 1, 2, 3, 4, 5 /)
integer :: d(10, 10)
character :: name(12)
integer :: ind = 2
!C874
!ERROR: Data object must not be a coindexed variable
DATA a[1] / 1 /
!C874
!ERROR: Data object must not be a coindexed variable
DATA(a[i], i = 1, 5) / 5 * 1 /
!C875
!ERROR: Data object variable must not be a function reference
DATA f(1) / 1 /
!C875
!ERROR: Data object must have constant subscripts
DATA b(ind) / 1 /
!C875
!ERROR: Data object must have constant subscripts
DATA name( : ind) / 'Ancd' /
!C875
!ERROR: Data object must have constant subscripts
DATA name(ind:) / 'Ancd' /
!C878
!ERROR: Data implied do object must be a variable
DATA(c(i), i = 1, 5) / 5 * 1 /
!C878
!ERROR: Data implied do object must be a variable
DATA(newNumsArray(i), i = 1, 2) &
/ specialNumbers(1, 2 * (/ 1, 2, 3, 4, 5 /)) /
!C880
!ERROR: Data implied do structure component must be subscripted
DATA(nums % one, i = 1, 5) / 5 * 1 /
!C879
!ERROR: Data implied do object must be a variable
DATA(newNums % numbers(i), i = 1, 5) / 5 * 1 /
!C879
!ERROR: Data implied do object must be a variable
DATA(newNumsArray(i) % one, i = 1, 5) / 5 * 1 /
!C880
!OK: Correct use
DATA(largeArray(j) % nums % one, j = 1, 5) / 5 * 1 /
!C880
!OK: Correct use
DATA(largeNumber % numsArray(j) % one, j = 1, 5) / 5 * 1 /
!C881
!ERROR: Data object must have constant subscripts
DATA(b(x), i = 1, 5) / 5 * 1 /
!C881
!OK: Correct use
DATA(nums % numbers(i), i = 1, 5) / 5 * 1 /
!C881
!OK: Correct use
DATA((d(i, j), i = 1, 10), j = 1, 10) / 100 * 1 /
!C881
!OK: Correct use
DATA(d(i, 1), i = 1, 10) / 10 * 1 /
end
end