mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-24 18:20:38 +00:00
99aa87a5b5
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
135 lines
3.3 KiB
Fortran
135 lines
3.3 KiB
Fortran
! RUN: %S/test_errors.sh %s %t %f18
|
|
! Construct names
|
|
|
|
subroutine s1
|
|
real :: foo
|
|
!ERROR: 'foo' is already declared in this scoping unit
|
|
foo: block
|
|
end block foo
|
|
end
|
|
|
|
subroutine s2(x)
|
|
logical :: x
|
|
foo: if (x) then
|
|
end if foo
|
|
!ERROR: 'foo' is already declared in this scoping unit
|
|
foo: do i = 1, 10
|
|
end do foo
|
|
end
|
|
|
|
subroutine s3
|
|
real :: a(10,10), b(10,10)
|
|
type y; end type
|
|
integer(8) :: x
|
|
!ERROR: Index name 'y' conflicts with existing identifier
|
|
forall(x=1:10, y=1:10)
|
|
a(x, y) = b(x, y)
|
|
end forall
|
|
!ERROR: Index name 'y' conflicts with existing identifier
|
|
forall(x=1:10, y=1:10) a(x, y) = b(x, y)
|
|
end
|
|
|
|
subroutine s4
|
|
real :: a(10), b(10)
|
|
complex :: x
|
|
integer :: i(2)
|
|
!ERROR: Must have INTEGER type, but is COMPLEX(4)
|
|
forall(x=1:10)
|
|
!ERROR: Must have INTEGER type, but is COMPLEX(4)
|
|
!ERROR: Must have INTEGER type, but is COMPLEX(4)
|
|
a(x) = b(x)
|
|
end forall
|
|
!ERROR: Must have INTEGER type, but is REAL(4)
|
|
forall(y=1:10)
|
|
!ERROR: Must have INTEGER type, but is REAL(4)
|
|
!ERROR: Must have INTEGER type, but is REAL(4)
|
|
a(y) = b(y)
|
|
end forall
|
|
!ERROR: Index variable 'i' is not scalar
|
|
forall(i=1:10)
|
|
a(i) = b(i)
|
|
end forall
|
|
end
|
|
|
|
subroutine s6
|
|
integer, parameter :: n = 4
|
|
real, dimension(n) :: x
|
|
data(x(i), i=1, n) / n * 0.0 /
|
|
!ERROR: Index name 't' conflicts with existing identifier
|
|
forall(t=1:n) x(t) = 0.0
|
|
contains
|
|
subroutine t
|
|
end
|
|
end
|
|
|
|
subroutine s6b
|
|
integer, parameter :: k = 4
|
|
integer :: l = 4
|
|
forall(integer(k) :: i = 1:10)
|
|
end forall
|
|
! C713 A scalar-int-constant-name shall be a named constant of type integer.
|
|
!ERROR: Must be a constant value
|
|
forall(integer(l) :: i = 1:10)
|
|
end forall
|
|
end
|
|
|
|
subroutine s7
|
|
!ERROR: 'i' is already declared in this scoping unit
|
|
do concurrent(integer::i=1:5) local(j, i) &
|
|
!ERROR: 'j' is already declared in this scoping unit
|
|
local_init(k, j) &
|
|
shared(a)
|
|
a = j + 1
|
|
end do
|
|
end
|
|
|
|
subroutine s8
|
|
implicit none
|
|
!ERROR: No explicit type declared for 'i'
|
|
do concurrent(i=1:5) &
|
|
!ERROR: No explicit type declared for 'j'
|
|
local(j) &
|
|
!ERROR: No explicit type declared for 'k'
|
|
local_init(k)
|
|
end do
|
|
end
|
|
|
|
subroutine s9
|
|
integer :: j
|
|
!ERROR: 'i' is already declared in this scoping unit
|
|
do concurrent(integer::i=1:5) shared(i) &
|
|
shared(j) &
|
|
!ERROR: 'j' is already declared in this scoping unit
|
|
shared(j)
|
|
end do
|
|
end
|
|
|
|
subroutine s10
|
|
external bad1
|
|
real, parameter :: bad2 = 1.0
|
|
x = cos(0.)
|
|
do concurrent(i=1:2) &
|
|
!ERROR: 'bad1' may not appear in a locality-spec because it is not definable
|
|
local(bad1) &
|
|
!ERROR: 'bad2' may not appear in a locality-spec because it is not definable
|
|
local(bad2) &
|
|
!ERROR: 'bad3' may not appear in a locality-spec because it is not definable
|
|
local(bad3) &
|
|
!ERROR: 'cos' may not appear in a locality-spec because it is not definable
|
|
local(cos)
|
|
end do
|
|
do concurrent(i=1:2) &
|
|
!ERROR: The name 'bad1' must be a variable to appear in a locality-spec
|
|
shared(bad1) &
|
|
!ERROR: The name 'bad2' must be a variable to appear in a locality-spec
|
|
shared(bad2) &
|
|
!ERROR: The name 'bad3' must be a variable to appear in a locality-spec
|
|
shared(bad3) &
|
|
!ERROR: The name 'cos' must be a variable to appear in a locality-spec
|
|
shared(cos)
|
|
end do
|
|
contains
|
|
subroutine bad3
|
|
end
|
|
end
|