[flang-commits] [flang] [llvm] [mlir] [flang][OpenMP] Restricting Integration test atomic-capture-release.f90 run to x86 and aarch64 (PR #200753)
via flang-commits
flang-commits at lists.llvm.org
Mon Jun 1 01:47:26 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: SunilKuravinakop
<details>
<summary>Changes</summary>
Similar to the the change in `flang/test/Integration/OpenMP/atomic-compare.f90`, restricting the test case `flang/test/Integration/OpenMP/atomic-capture-release.f90` to run on ```
x86-registered-target & aarch64-registered-target
flang/test/Integration/OpenMP/atomic-capture-release.f90
```
---
Patch is 27.34 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/200753.diff
13 Files Affected:
- (modified) flang/lib/Lower/OpenMP/Atomic.cpp (+34-16)
- (modified) flang/lib/Semantics/check-omp-atomic.cpp (+63)
- (added) flang/test/Integration/OpenMP/atomic-capture-release.f90 (+45)
- (modified) flang/test/Integration/OpenMP/atomic-compare.f90 (+2-2)
- (added) flang/test/Lower/OpenMP/atomic-mem-order-transform.f90 (+59)
- (modified) flang/test/Lower/OpenMP/atomic-requires-conflict-v50-3.f90 (+1-1)
- (modified) flang/test/Lower/OpenMP/atomic-requires-conflict-v50-4.f90 (+1-1)
- (modified) flang/test/Lower/OpenMP/requires-admo-acqrel.f90 (+2-2)
- (added) flang/test/Semantics/OpenMP/atomic-mem-order.f90 (+95)
- (modified) flang/test/Semantics/OpenMP/atomic01.f90 (+14)
- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+19-2)
- (modified) mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp (+33-10)
- (modified) mlir/test/Dialect/OpenMP/invalid.mlir (+4-4)
``````````diff
diff --git a/flang/lib/Lower/OpenMP/Atomic.cpp b/flang/lib/Lower/OpenMP/Atomic.cpp
index cbca2fc52b93f..b80564fddd943 100644
--- a/flang/lib/Lower/OpenMP/Atomic.cpp
+++ b/flang/lib/Lower/OpenMP/Atomic.cpp
@@ -244,22 +244,37 @@ makeValidForAction(std::optional<mlir::omp::ClauseMemoryOrderKind> memOrder,
using Analysis = parser::OpenMPAtomicConstruct::Analysis;
// Figure out the main action (i.e. disregard a potential capture operation)
int action = action0;
- if (action1 != Analysis::None)
+ bool isCapture = action1 != Analysis::None;
+ if (isCapture)
action = action0 == Analysis::Read ? action1 : action0;
+ // All orderings are valid for capture operations per the OpenMP spec.
+ // The individual sub-operations (read/write/update) inside the capture
+ // will have their orderings handled separately.
+ if (isCapture)
+ return memOrder;
+
// Avaliable orderings: acquire, acq_rel, relaxed, release, seq_cst
- if (action == Analysis::Read) {
- // "acq_rel" decays to "acquire"
- if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel)
- return mlir::omp::ClauseMemoryOrderKind::Acquire;
- } else if (action == Analysis::Write) {
- // "acq_rel" decays to "release"
- if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel)
- return mlir::omp::ClauseMemoryOrderKind::Release;
+ if (version == 50) {
+ if (action == Analysis::Read) {
+ // "acq_rel" decays to "acquire" for read
+ if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel)
+ return mlir::omp::ClauseMemoryOrderKind::Acquire;
+ } else if (action == Analysis::Write) {
+ // "acq_rel" decays to "release" for write
+ if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel)
+ return mlir::omp::ClauseMemoryOrderKind::Release;
+ } else if (action == Analysis::Update) {
+ // "acquire" decays to "relaxed", "acq_rel" decays to "release"
+ if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acquire)
+ return mlir::omp::ClauseMemoryOrderKind::Relaxed;
+ if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel)
+ return mlir::omp::ClauseMemoryOrderKind::Release;
+ }
}
- if (version > 50) {
+ if (version >= 50) {
if (action == Analysis::Read) {
// "release" prohibited
if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Release)
@@ -321,8 +336,10 @@ genAtomicRead(lower::AbstractConverter &converter,
if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Release) {
// Reset it back to the default.
memOrder = getDefaultAtomicMemOrder(semaCtx);
- } else if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel) {
- // The MLIR verifier doesn't like acq_rel either.
+ } else if (semaCtx.langOptions().OpenMPVersion <= 50 &&
+ *memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel) {
+ // In OpenMP 5.0, acq_rel is not allowed on read; decay to acquire.
+ // In OpenMP 5.1+, acq_rel is permitted on read.
memOrder = mlir::omp::ClauseMemoryOrderKind::Acquire;
}
}
@@ -380,8 +397,10 @@ genAtomicWrite(lower::AbstractConverter &converter,
if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acquire) {
// Reset it back to the default.
memOrder = getDefaultAtomicMemOrder(semaCtx);
- } else if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel) {
- // The MLIR verifier doesn't like acq_rel either.
+ } else if (semaCtx.langOptions().OpenMPVersion <= 50 &&
+ *memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel) {
+ // In OpenMP 5.0, acq_rel is not allowed on write; decay to release.
+ // In OpenMP 5.1+, acq_rel is permitted on write.
memOrder = mlir::omp::ClauseMemoryOrderKind::Release;
}
}
@@ -537,8 +556,7 @@ void Fortran::lower::omp::lowerAtomic(
unsigned version = semaCtx.langOptions().OpenMPVersion;
int action0 = analysis.op0.what & analysis.Action;
int action1 = analysis.op1.what & analysis.Action;
- if (canOverride)
- memOrder = makeValidForAction(memOrder, action0, action1, version);
+ memOrder = makeValidForAction(memOrder, action0, action1, version);
if (auto *cond = get(analysis.cond)) {
// atomic compare: if (x == e) x = d
diff --git a/flang/lib/Semantics/check-omp-atomic.cpp b/flang/lib/Semantics/check-omp-atomic.cpp
index f722de8d8dc46..a61a868c9baa4 100644
--- a/flang/lib/Semantics/check-omp-atomic.cpp
+++ b/flang/lib/Semantics/check-omp-atomic.cpp
@@ -1537,6 +1537,67 @@ void OmpStructureChecker::CheckAtomicUpdate(
}
}
+static void checkIncompatibleMemoryOrderClause(SemanticsContext &context,
+ const parser::OpenMPAtomicConstruct &x,
+ const std::array<llvm::omp::Clause, 3> atomic,
+ const std::array<llvm::omp::Clause, 5> memoryOrder) {
+
+ // Check for incompatible memory orderings on specific atomic operations.
+ // Per OpenMP 5.0:
+ // - atomic read: release and acq_rel are not allowed
+ // - atomic write: acquire and acq_rel are not allowed
+ // - atomic update (without capture): acquire and acq_rel are not allowed
+ // Per OpenMP 5.1+:
+ // - atomic read: release is not allowed
+ // - atomic write: acquire is not allowed
+ // (no restrictions on update)
+ llvm::omp::Clause kind{x.GetKind()};
+ const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
+
+ unsigned version{context.langOptions().OpenMPVersion};
+ if (version < 50)
+ return;
+
+ const parser::OmpClause *memOrderClause{nullptr};
+ for (const parser::OmpClause &clause : dirSpec.Clauses().v) {
+ if (llvm::is_contained(memoryOrder, clause.Id())) {
+ memOrderClause = &clause;
+ break;
+ }
+ }
+ if (!memOrderClause)
+ return;
+
+ llvm::omp::Clause memOrd{memOrderClause->Id()};
+ bool isCapture{x.IsCapture()};
+ if (kind == llvm::omp::Clause::OMPC_read) {
+ if (memOrd == llvm::omp::Clause::OMPC_release) {
+ context.Say(memOrderClause->source,
+ "An ATOMIC READ operation must not have RELEASE as the memory order, using RELAXED"_warn_en_US);
+ } else if (version < 51 && memOrd == llvm::omp::Clause::OMPC_acq_rel) {
+ context.Say(memOrderClause->source,
+ "An ATOMIC READ operation must not have ACQ_REL as the memory order, using ACQUIRE"_warn_en_US);
+ }
+ } else if (kind == llvm::omp::Clause::OMPC_write && !isCapture) {
+ if (memOrd == llvm::omp::Clause::OMPC_acquire) {
+ context.Say(memOrderClause->source,
+ "An ATOMIC WRITE operation must not have ACQUIRE as the memory order, using RELAXED"_warn_en_US);
+ } else if (version < 51 && memOrd == llvm::omp::Clause::OMPC_acq_rel) {
+ context.Say(memOrderClause->source,
+ "An ATOMIC WRITE operation must not have ACQ_REL as the memory order, using RELEASE"_warn_en_US);
+ }
+ } else if (version == 50 && kind == llvm::omp::Clause::OMPC_update &&
+ !isCapture) {
+ if (memOrd == llvm::omp::Clause::OMPC_acquire) {
+ context.Say(memOrderClause->source,
+ "An ATOMIC UPDATE operation must not have ACQUIRE as the memory order, using RELAXED"_warn_en_US);
+ } else if (memOrd == llvm::omp::Clause::OMPC_acq_rel) {
+ context.Say(memOrderClause->source,
+ "An ATOMIC UPDATE operation must not have ACQ_REL as the memory order, using RELEASE"_warn_en_US);
+ }
+ }
+}
+
void OmpStructureChecker::Enter(const parser::OpenMPAtomicConstruct &x) {
if (visitedAtomicSource_.empty())
visitedAtomicSource_ = x.source;
@@ -1587,6 +1648,8 @@ void OmpStructureChecker::Enter(const parser::OpenMPAtomicConstruct &x) {
checkExclusive(atomic, "atomic", dirSpec.Clauses());
checkExclusive(memoryOrder, "memory-order", dirSpec.Clauses());
+ checkIncompatibleMemoryOrderClause(context_, x, atomic, memoryOrder);
+
switch (kind) {
case llvm::omp::Clause::OMPC_read:
CheckAtomicRead(x);
diff --git a/flang/test/Integration/OpenMP/atomic-capture-release.f90 b/flang/test/Integration/OpenMP/atomic-capture-release.f90
new file mode 100644
index 0000000000000..d0090f7e6ee02
--- /dev/null
+++ b/flang/test/Integration/OpenMP/atomic-capture-release.f90
@@ -0,0 +1,45 @@
+!===----------------------------------------------------------------------===!
+! This directory can be used to add Integration tests involving multiple
+! stages of the compiler (for eg. from Fortran to LLVM IR). It should not
+! contain executable tests. We should only add tests here sparingly and only
+! if there is no other way to test. Repeat this message in each test that is
+! added to this directory and sub-directories.
+!===----------------------------------------------------------------------===!
+
+!RUN: %if x86-registered-target %{ %flang_fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fopenmp -fopenmp-version=51 %s -o - | FileCheck %s %}
+!RUN: %if aarch64-registered-target %{ %flang_fc1 -triple aarch64-unknown-linux-gnu -emit-llvm -fopenmp -fopenmp-version=51 %s -o - | FileCheck %s %}
+
+! Real(4) capture with release ordering: the initial load in the cmpxchg loop
+! must use monotonic (not release, which is invalid for loads in LLVM IR).
+!CHECK: define void {{.*}}test_capture_release_(
+!CHECK-SAME: ptr noalias %[[A:.*]], ptr noalias %[[B:.*]], ptr noalias %[[C:.*]])
+!CHECK: [[ENTRY:.*]]:
+!CHECK: [[ATOMIC_LOAD:.*]] = load atomic i32, ptr %[[A]] monotonic, align 4
+!CHECK: [[CONT:.*]]:
+!CHECK: cmpxchg ptr %[[A]], i32 %{{.*}}, i32 %{{.*}} release monotonic
+!CHECK: [[EXIT:.*]]:
+!CHECK: call void {{.*}}__kmpc_flush{{.*}}
+!CHECK: ret
+subroutine test_capture_release(a,b,c)
+ real(4) :: a, b, c
+ !$omp atomic capture release
+ c = a
+ a = a + b
+ !$omp end atomic
+end subroutine
+
+! Integer(4) capture with acq_rel ordering: uses atomicrmw (valid with acq_rel).
+!CHECK: define void {{.*}}test_capture_acq_rel_(
+!CHECK-SAME: ptr noalias %[[A:.*]], ptr noalias %[[B:.*]], ptr noalias %[[C:.*]])
+!CHECK: %[[TMP1:.*]] = load {{.*}}, ptr %[[B]]
+!CHECK: [[ENTRY:.*]]:
+!CHECK: %[[TMP2:.*]] = atomicrmw add ptr %[[A]], i32 %[[TMP1]] acq_rel
+!CHECK: call void {{.*}}__kmpc_flush{{.*}}
+!CHECK: ret
+subroutine test_capture_acq_rel(a,b,c)
+ integer(4) :: a, b, c
+ !$omp atomic capture acq_rel
+ c = a
+ a = a + b
+ !$omp end atomic
+end subroutine
diff --git a/flang/test/Integration/OpenMP/atomic-compare.f90 b/flang/test/Integration/OpenMP/atomic-compare.f90
index 7a30223ad1e73..92d6726996eab 100644
--- a/flang/test/Integration/OpenMP/atomic-compare.f90
+++ b/flang/test/Integration/OpenMP/atomic-compare.f90
@@ -34,7 +34,7 @@ subroutine atomic_compare_seq_cst(x, e, d)
if (x == e) x = d
end
-! acquire ordering → cmpxchg acquire
+! acquire ordering on compare (update) is valid in OpenMP 5.1
!CHECK-LABEL: define void @atomic_compare_acquire_(
!CHECK-SAME: ptr noalias %[[X:.*]], ptr noalias %[[E:.*]], ptr noalias %[[D:.*]])
!CHECK: %[[EVAL:.*]] = load i32, ptr %[[E]], align 4
@@ -94,7 +94,7 @@ subroutine atomic_compare_lt_seq_cst(x, e)
if (x < e) x = e
end
-! Less-than with acquire → atomicrmw max acquire (signed)
+! Less-than with acquire on compare (update) is valid in OpenMP 5.1
!CHECK-LABEL: define void @atomic_compare_lt_acquire_(
!CHECK-SAME: ptr noalias %[[X:.*]], ptr noalias %[[E:.*]])
!CHECK: %[[EVAL:.*]] = load i32, ptr %[[E]], align 4
diff --git a/flang/test/Lower/OpenMP/atomic-mem-order-transform.f90 b/flang/test/Lower/OpenMP/atomic-mem-order-transform.f90
new file mode 100644
index 0000000000000..d5139352d541d
--- /dev/null
+++ b/flang/test/Lower/OpenMP/atomic-mem-order-transform.f90
@@ -0,0 +1,59 @@
+!RUN: %flang_fc1 -emit-hlfir %openmp_flags -fopenmp-version=50 %s -o - 2>&1 | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir %openmp_flags -fopenmp-version=51 %s -o - 2>&1 | FileCheck %s --check-prefix=CHECK51
+
+! Test that incompatible memory orderings on atomic operations are
+! transformed to valid orderings during lowering.
+
+! read + release -> relaxed
+!CHECK: omp.atomic.read %{{.*}} = %{{.*}} memory_order(relaxed)
+!CHECK51: omp.atomic.read %{{.*}} = %{{.*}} memory_order(relaxed)
+subroutine test_read_release(x, v)
+ integer :: x, v
+ !$omp atomic read release
+ v = x
+end
+
+! read + acq_rel -> acquire (5.0 only; untouched in 5.1)
+!CHECK: omp.atomic.read %{{.*}} = %{{.*}} memory_order(acquire)
+!CHECK51: omp.atomic.read %{{.*}} = %{{.*}} memory_order(acq_rel)
+subroutine test_read_acq_rel(x, v)
+ integer :: x, v
+ !$omp atomic read acq_rel
+ v = x
+end
+
+! write + acquire -> relaxed
+!CHECK: omp.atomic.write %{{.*}} = %{{.*}} memory_order(relaxed)
+!CHECK51: omp.atomic.write %{{.*}} = %{{.*}} memory_order(relaxed)
+subroutine test_write_acquire(x, v)
+ integer :: x, v
+ !$omp atomic write acquire
+ x = v
+end
+
+! write + acq_rel -> release (5.0 only; untouched in 5.1)
+!CHECK: omp.atomic.write %{{.*}} = %{{.*}} memory_order(release)
+!CHECK51: omp.atomic.write %{{.*}} = %{{.*}} memory_order(acq_rel)
+subroutine test_write_acq_rel(x, v)
+ integer :: x, v
+ !$omp atomic write acq_rel
+ x = v
+end
+
+! update + acquire -> relaxed (5.0 only; untouched in 5.1)
+!CHECK: omp.atomic.update memory_order(relaxed)
+!CHECK51: omp.atomic.update memory_order(acquire)
+subroutine test_update_acquire(x)
+ integer :: x
+ !$omp atomic update acquire
+ x = x + 1
+end
+
+! update + acq_rel -> release (5.0 only; untouched in 5.1)
+!CHECK: omp.atomic.update memory_order(release)
+!CHECK51: omp.atomic.update memory_order(acq_rel)
+subroutine test_update_acq_rel(x)
+ integer :: x
+ !$omp atomic update acq_rel
+ x = x + 1
+end
diff --git a/flang/test/Lower/OpenMP/atomic-requires-conflict-v50-3.f90 b/flang/test/Lower/OpenMP/atomic-requires-conflict-v50-3.f90
index bc7529c69340a..4a265e851fce4 100644
--- a/flang/test/Lower/OpenMP/atomic-requires-conflict-v50-3.f90
+++ b/flang/test/Lower/OpenMP/atomic-requires-conflict-v50-3.f90
@@ -1,7 +1,7 @@
!RUN: bbc %openmp_flags -fopenmp-version=50 -emit-hlfir %s -o - | FileCheck %s
!RUN: %flang_fc1 -emit-hlfir %openmp_flags -fopenmp-version=50 %s -o - | FileCheck %s
-!CHECK: omp.atomic.update memory_order(relaxed)
+!CHECK: omp.atomic.update memory_order(release)
subroutine f05(x, v)
integer :: x, v
diff --git a/flang/test/Lower/OpenMP/atomic-requires-conflict-v50-4.f90 b/flang/test/Lower/OpenMP/atomic-requires-conflict-v50-4.f90
index 5cffb1ac9d6c4..81678771a69cd 100644
--- a/flang/test/Lower/OpenMP/atomic-requires-conflict-v50-4.f90
+++ b/flang/test/Lower/OpenMP/atomic-requires-conflict-v50-4.f90
@@ -1,7 +1,7 @@
!RUN: bbc %openmp_flags -fopenmp-version=50 -emit-hlfir %s -o - | FileCheck %s
!RUN: %flang_fc1 -emit-hlfir %openmp_flags -fopenmp-version=50 %s -o - | FileCheck %s
-!CHECK: omp.atomic.capture memory_order(relaxed)
+!CHECK: omp.atomic.capture memory_order(acquire)
subroutine f06(x, v)
integer :: x, v
diff --git a/flang/test/Lower/OpenMP/requires-admo-acqrel.f90 b/flang/test/Lower/OpenMP/requires-admo-acqrel.f90
index 525a846f410d8..7691e03362d31 100644
--- a/flang/test/Lower/OpenMP/requires-admo-acqrel.f90
+++ b/flang/test/Lower/OpenMP/requires-admo-acqrel.f90
@@ -7,11 +7,11 @@ module m
subroutine f00(x, v)
integer :: x, v
-!CHECK: omp.atomic.read %{{[ %#=0-9]+}} memory_order(acquire)
+!CHECK: omp.atomic.read %{{[ %#=0-9]+}} memory_order(acq_rel)
!$omp atomic read
v = x
-!CHECK: omp.atomic.write %{{[ %#=0-9]+}} memory_order(release)
+!CHECK: omp.atomic.write %{{[ %#=0-9]+}} memory_order(acq_rel)
!$omp atomic write
x = v
end
diff --git a/flang/test/Semantics/OpenMP/atomic-mem-order.f90 b/flang/test/Semantics/OpenMP/atomic-mem-order.f90
new file mode 100644
index 0000000000000..cdf2242f88799
--- /dev/null
+++ b/flang/test/Semantics/OpenMP/atomic-mem-order.f90
@@ -0,0 +1,95 @@
+! REQUIRES: openmp_runtime
+
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=51
+! Semantic checks for incompatible memory orderings on atomic operations.
+
+subroutine test_atomic_read_mem_order()
+ integer :: x, v
+
+ ! Valid orderings for read
+ !$omp atomic read seq_cst
+ v = x
+ !$omp atomic read acquire
+ v = x
+ !$omp atomic read relaxed
+ v = x
+
+ ! Invalid orderings for read
+ !WARNING: An ATOMIC READ operation must not have RELEASE as the memory order, using RELAXED
+ !$omp atomic read release
+ v = x
+ !$omp atomic read acq_rel
+ v = x
+end subroutine
+
+subroutine test_atomic_write_mem_order()
+ integer :: x, v
+
+ ! Valid orderings for write
+ !$omp atomic write seq_cst
+ x = v
+ !$omp atomic write release
+ x = v
+ !$omp atomic write relaxed
+ x = v
+
+ ! Invalid orderings for write
+ !WARNING: An ATOMIC WRITE operation must not have ACQUIRE as the memory order, using RELAXED
+ !$omp atomic write acquire
+ x = v
+ !$omp atomic write acq_rel
+ x = v
+end subroutine
+
+subroutine test_atomic_update_mem_order()
+ integer :: x
+
+ ! Valid orderings for update
+ !$omp atomic update seq_cst
+ x = x + 1
+ !$omp atomic update release
+ x = x + 1
+ !$omp atomic update relaxed
+ x = x + 1
+
+ ! No restrictions on update in OpenMP 5.1
+ !$omp atomic update acquire
+ x = x + 1
+ !$omp atomic update acq_rel
+ x = x + 1
+end subroutine
+
+subroutine test_atomic_capture_mem_order()
+ integer :: x, v
+
+ ! Valid orderings for capture (all are allowed, but some produce warnings)
+ !$omp atomic capture seq_cst
+ v = x
+ x = x + 1
+ !$omp end atomic
+ !$omp atomic capture acquire
+ v = x
+ x = x + 1
+ !$omp end atomic
+ !$omp atomic capture relaxed
+ v = x
+ x = x + 1
+ !$omp end atomic
+
+ ! Capture with release/acq_rel: valid, no restrictions
+ !$omp atomic capture release
+ v = x
+ x = x + 1
+ !$omp end atomic
+ !$omp atomic capture acq_rel
+ v = x
+ x = x + 1
+ !$omp end atomic
+
+ ! Trigger an error so test_errors.py captures stderr
+ !ERROR: ATOMIC READ cannot have COMPARE or CAPTURE clauses
+ !$omp atomic read capture
+ v = x
+ x = x + 1
+ !$omp end atomic
+end subroutine
diff --git a/flang/test/Semantics/OpenMP/atomic01.f90 b/flang/test/Semantics/OpenMP/atomic01.f90
index f700c381cadd0..1ef985de67aeb 100644
--- a/flang/test/Semantics/OpenMP/atomic01.f90
+++ b/flang/test/Semantics/OpenMP/atomic01.f90
@@ -292,26 +292,34 @@
! 2.17.7.4
! If atomic-clause is read then memory-order-clause must not be acq_rel or release.
+ !WARNING: An ATOMIC READ operation must not have ACQ_REL as the memory order, using ACQUIRE
!$omp atomic acq_rel read
i = j
+ !WARNING: An ATOMIC READ operation must not have ACQ_REL as the memory order, using ACQUIRE
!$omp atomic read acq_rel
i = j
+ !WARNING: An ATOMIC READ operation must not have RELEASE as the memory order, using RELAXED
!$omp atomic release read
i = j
+ !WARNING: An ATOMIC READ operation must not have RELEASE as the memory order, using RELAXED
!$omp atomic read release
i = j
! 2.17.7.5
! If atomic-clause is write then memory-order-clause must not be acq_rel or acquire.
+ !WARNING: An ATOMIC WRITE operation must not have ACQ_REL as the memory order, using RELEASE
!$omp atomic acq_rel write
i = j
+ !WARNING: An ATOMIC WRITE operation must not have ACQ_REL as the memory order, using RELEASE
!$omp atomic write acq_rel
i = j
+ !WARNING: An ATOMIC WRITE operation must not have ACQUIRE as the memory order, using RELAXED
!$omp atomic acquire write
i = j
+ !WARNING: An ATOMIC WRITE operation must not have ACQUIRE as the memory order, using RELAXED
!$omp atomic write acquire
i = j
@@ -319,25 +327,31 @@
! 2.17.7.6
! If atomic-clause is update or not present then memory-order-clause must not be acq_rel or acquire.
+ !WARNING: An ATOMIC UPDATE operation must not have ACQ_REL as the memory order, using RELEASE
!$omp atomic acq_rel update
!ERROR: The atomic variable i should appear as an argument in the update operation
i = j
+ !WARNING: An ATOMIC UPDATE operation must not have ACQ_REL as the memory order, using RELEASE
!$omp atomic update acq_rel
!ERROR: The atomic variable i should appear as an argument in the update operation
i = j
+ !WARNING: An ATOMIC UPDATE operation must not have ACQUIRE as the memory order, using RELAXED
!$omp atomic acquire update
!ERROR: The atomic variable i should appear as an argument in the update operation
i = j
+ !WARNING: An ATOMIC UPDATE operation must not have ACQUIRE as the memory order, using RELAXED
!$omp atomic update acquire
!ERROR: The atomic variable i should appear as an argument in the update ope...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/200753
More information about the flang-commits
mailing list