Files
clang-p2996/flang/test/Semantics/OpenMP/requires02.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

18 lines
564 B
Fortran

! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP Version 5.0
! 2.4 Requires directive
! All atomic_default_mem_order clauses in 'requires' directives must come
! strictly before any atomic directives on which the memory_order clause is not
! specified.
subroutine f
integer :: a = 0
!$omp atomic
a = a + 1
end subroutine f
subroutine g
!ERROR: REQUIRES directive with 'ATOMIC_DEFAULT_MEM_ORDER' clause found lexically after atomic operation without a memory order clause
!$omp requires atomic_default_mem_order(relaxed)
end subroutine g