[flang-commits] [flang] [llvm] [mlir] [Flang][OpenMP]Handling restrictions of using Memory-Order-Clause with Atomic-Clause (PR #199636)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Fri May 29 06:00:52 PDT 2026


================
@@ -1587,6 +1587,59 @@ void OmpStructureChecker::Enter(const parser::OpenMPAtomicConstruct &x) {
   checkExclusive(atomic, "atomic", dirSpec.Clauses());
   checkExclusive(memoryOrder, "memory-order", dirSpec.Clauses());
 
+  // 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
----------------
kparzysz wrote:

Capture doesn't really add anything.  It's a "read" operation, but it's only allowed when the atomic operation is an update (which is already presumed to be read+write).
I'm not sure whether you're asking about the if statement at line 254 or about the "capture implies update" statement. The latter is already checked.

https://github.com/llvm/llvm-project/pull/199636


More information about the flang-commits mailing list