[flang-commits] [flang] [llvm] [flang][OpenMP] Overhaul implementation of ATOMIC construct (PR #137852)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Wed Jun 4 14:17:00 PDT 2025
================
@@ -0,0 +1,81 @@
+!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=60
+
+subroutine f00
+ integer :: x, v
+ ! The end-directive is optional in ATOMIC WRITE. Expect no diagnostics.
+ !$omp atomic write
+ x = v + 1
+
+ !$omp atomic write
+ x = v + 3
+ !$omp end atomic
+end
+
+subroutine f01
+ integer, pointer :: x, v
+ ! Intrinsic assignment and pointer assignment are both ok. Expect no
+ ! diagnostics.
+ !$omp atomic write
+ x = 2 * v + 3
+
+ !$omp atomic write
+ x => v
+end
+
+subroutine f02(i)
+ integer :: i, v
+ interface
+ function p(i)
+ integer, pointer :: p
+ integer :: i
+ end
+ end interface
+
+ ! Atomic variable can be a function reference. Expect no diagostics.
+ !$omp atomic write
+ p(i) = v
+end
+
+subroutine f03
+ integer :: x(3), y(5), v(3)
+
+ !$omp atomic write
+ !ERROR: Atomic variable x should be a scalar
+ x = v
----------------
kparzysz wrote:
Added a couple of testcases to atomic-read.f90.
https://github.com/llvm/llvm-project/pull/137852
More information about the flang-commits
mailing list