This patch adds the following semantic checks: - None of expr, and expr_list (as applicable) may access the same storage location as x - Atomic update statement should be of the form x = x operator expr or x = expr operator x or x = intrinsic_procedure(x, expr_list) or x = intrinsic_procedure(expr_list, x) - expr_list is a comma-separated, non-empty list of scalar expressions. If intrinsic_procedure_name refers to IAND, IOR, or IEOR, exactly one expression must appear in expr_list Reviewed By: TIFitis Differential Revision: https://reviews.llvm.org/D128162
28 lines
1.0 KiB
Fortran
28 lines
1.0 KiB
Fortran
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
|
|
|
|
! This tests the various semantics related to the clauses of various OpenMP atomic constructs
|
|
|
|
program OmpAtomic
|
|
use omp_lib
|
|
integer :: g, x
|
|
|
|
!ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
|
|
!$omp atomic relaxed, seq_cst
|
|
x = x + 1
|
|
!ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
|
|
!$omp atomic read seq_cst, relaxed
|
|
x = g
|
|
!ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
|
|
!$omp atomic write relaxed, release
|
|
x = 2 * 4
|
|
!ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
|
|
!$omp atomic update release, seq_cst
|
|
!ERROR: Invalid or missing operator in atomic update statement
|
|
x = 10
|
|
!ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
|
|
!$omp atomic capture release, seq_cst
|
|
x = g
|
|
g = x * 10
|
|
!$omp end atomic
|
|
end program OmpAtomic
|