There were several different ways of handling the option to f18 to find predefined modules: - test_errors.sh was created by cmake substituting FLANG_INTRINSIC_MODULES_DIR into test_errors.sh.in - some tests used the flang script which has the option built it - some tests used %f18_with_includes which was replaced by the path to f18 plus the -I option - some included -I../../include/flang in their run command To make this more consistent, change %f18 to include the -intrinsic-module-directory option and use it everywhere, including to replace %flang and %f18_with_includes. This requires changing all of the invocations of the test scripts to put %f18 at the end so that it can expand to more than one argument. This eliminates the need to generate test_errors.sh which means we don't need flang/test/Semantics/CMakeLists.txt or the %B substitution. That makes the test_errors.sh command like the others, replacing %B/test/Semantics/test_errors.sh with %S/test_errors.sh. Also remove the OPTIONS: functionality as custom options can be included in the RUN: command. And remove -I/../../include/flang as that is now always included. Differential Revision: https://reviews.llvm.org/D79634
85 lines
2.6 KiB
Fortran
85 lines
2.6 KiB
Fortran
! 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 /
|
|
!C880
|
|
!OK: Correct use
|
|
DATA(largeArray(j) % nums % one, j = 1, 10) / 10 * 1 /
|
|
!C880
|
|
!OK: Correct use
|
|
DATA(largeNumber % numsArray(j) % one, j = 1, 10) / 10 * 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
|