Files
clang-p2996/flang/test/Semantics/resolve55.f90
Tim Keith 99aa87a5b5 [flang][NFC] Simplify semantics test scripts
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
2020-05-11 11:49:25 -07:00

95 lines
2.3 KiB
Fortran

! RUN: %S/test_errors.sh %s %t %f18
! Tests for C1128:
! A variable-name that appears in a LOCAL or LOCAL_INIT locality-spec shall not
! have the ALLOCATABLE; INTENT (IN); or OPTIONAL attribute; shall not be of
! finalizable type; shall not be a nonpointer polymorphic dummy argument; and
! shall not be a coarray or an assumed-size array.
subroutine s1()
! Cannot have ALLOCATABLE variable in a locality spec
integer, allocatable :: k
!ERROR: ALLOCATABLE variable 'k' not allowed in a locality-spec
do concurrent(i=1:5) local(k)
end do
end subroutine s1
subroutine s2(arg)
! Cannot have a dummy OPTIONAL in a locality spec
integer, optional :: arg
!ERROR: OPTIONAL argument 'arg' not allowed in a locality-spec
do concurrent(i=1:5) local(arg)
end do
end subroutine s2
subroutine s3(arg)
! This is OK
real :: arg
do concurrent(i=1:5) local(arg)
end do
end subroutine s3
subroutine s4(arg)
! Cannot have a dummy INTENT(IN) in a locality spec
real, intent(in) :: arg
!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec
do concurrent(i=1:5) local(arg)
end do
end subroutine s4
subroutine s5()
! Cannot have a variable of a finalizable type in a locality spec
type t1
integer :: i
contains
final :: f
end type t1
type(t1) :: var
!ERROR: Finalizable variable 'var' not allowed in a locality-spec
do concurrent(i=1:5) local(var)
end do
contains
subroutine f(x)
type(t1) :: x
end subroutine f
end subroutine s5
subroutine s6
! Cannot have a nonpointer polymorphic dummy argument in a locality spec
type :: t
integer :: field
end type t
contains
subroutine s(x, y)
class(t), pointer :: x
class(t) :: y
! This is allowed
do concurrent(i=1:5) local(x)
end do
! This is not allowed
!ERROR: Nonpointer polymorphic argument 'y' not allowed in a locality-spec
do concurrent(i=1:5) local(y)
end do
end subroutine s
end subroutine s6
subroutine s7()
! Cannot have a coarray
integer, codimension[*] :: coarray_var
!ERROR: Coarray 'coarray_var' not allowed in a locality-spec
do concurrent(i=1:5) local(coarray_var)
end do
end subroutine s7
subroutine s8(arg)
! Cannot have an assumed size array
integer, dimension(*) :: arg
!ERROR: Assumed size array 'arg' not allowed in a locality-spec
do concurrent(i=1:5) local(arg)
end do
end subroutine s8