llvm/flang/test/Semantics/critical02.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

123 lines
2.8 KiB
Fortran

! RUN: %S/test_errors.sh %s %t %f18
!C1118
subroutine test1
critical
!ERROR: RETURN statement is not allowed in a CRITICAL construct
return
end critical
end subroutine test1
subroutine test2()
implicit none
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
SYNC ALL
end critical
end subroutine test2
subroutine test3()
use iso_fortran_env, only: team_type
implicit none
type(team_type) :: j
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
sync team (j)
end critical
end subroutine test3
subroutine test4()
integer, allocatable, codimension[:] :: ca
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
allocate(ca[*])
end critical
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
deallocate(ca)
end critical
end subroutine test4
subroutine test5()
use iso_fortran_env, only: team_type
implicit none
type(team_type) :: j
critical
change team (j)
!ERROR: An image control statement is not allowed in a CRITICAL construct
end team
end critical
end subroutine test5
subroutine test6
critical
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
end critical
end critical
end subroutine test6
subroutine test7()
use iso_fortran_env
type(event_type) :: x, y
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
event post (x)
!ERROR: An image control statement is not allowed in a CRITICAL construct
event wait (y)
end critical
end subroutine test7
subroutine test8()
use iso_fortran_env
type(team_type) :: t
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
form team(1, t)
end critical
end subroutine test8
subroutine test9()
use iso_fortran_env
type(lock_type) :: l
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
lock(l)
!ERROR: An image control statement is not allowed in a CRITICAL construct
unlock(l)
end critical
end subroutine test9
subroutine test10()
use iso_fortran_env
integer, allocatable, codimension[:] :: ca
allocate(ca[*])
critical
block
integer, allocatable, codimension[:] :: cb
cb = ca
!TODO: Deallocation of this coarray is not currently caught
end block
end critical
end subroutine test10
subroutine test11()
integer, allocatable, codimension[:] :: ca, cb
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
call move_alloc(cb, ca)
end critical
end subroutine test11
subroutine test12()
critical
!ERROR: An image control statement is not allowed in a CRITICAL construct
stop
end critical
end subroutine test12