Files
clang-p2996/flang/test/Semantics/OpenMP/requires06.f90
Sergio Afonso 2221b758d2 [Flang][OpenMP][Sema] Add semantics checks for REQUIRES directive
This patch adds semantics checks for REQUIRES directives appearing after other
directives that are affected by them. In particular, it adds checks for device
constructs appearing after device-related REQUIRES directives and for the
`atomic_default_mem_order` clause appearing after atomic operations where the
memory order is not explicitly specified.

This is patch 2/5 of a series splitting D149337 to simplify review.

Depends on D157710.

Differential Revision: https://reviews.llvm.org/D157722
2023-08-15 12:38:14 +01:00

21 lines
876 B
Fortran

! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP Version 5.0
! 2.4 Requires directive
! Target-related clauses in 'requires' directives must come strictly before any
! device constructs, such as declare target with extended list.
subroutine f
!$omp declare target (f)
end subroutine f
subroutine g
!ERROR: REQUIRES directive with 'DYNAMIC_ALLOCATORS' clause found lexically after device construct
!$omp requires dynamic_allocators
!ERROR: REQUIRES directive with 'REVERSE_OFFLOAD' clause found lexically after device construct
!$omp requires reverse_offload
!ERROR: REQUIRES directive with 'UNIFIED_ADDRESS' clause found lexically after device construct
!$omp requires unified_address
!ERROR: REQUIRES directive with 'UNIFIED_SHARED_MEMORY' clause found lexically after device construct
!$omp requires unified_shared_memory
end subroutine g