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