[flang-commits] [flang] d94582e - [flang][OpenMP] Add test for checking overloaded operator in atomic update (#88471)

via flang-commits flang-commits at lists.llvm.org
Thu May 16 07:28:43 PDT 2024


Author: NimishMishra
Date: 2024-05-16T07:28:40-07:00
New Revision: d94582eea410a04f9f84e39a54276a8418aa2dbb

URL: https://github.com/llvm/llvm-project/commit/d94582eea410a04f9f84e39a54276a8418aa2dbb
DIFF: https://github.com/llvm/llvm-project/commit/d94582eea410a04f9f84e39a54276a8418aa2dbb.diff

LOG: [flang][OpenMP] Add test for checking overloaded operator in atomic update (#88471)

Atomic update expression does not allow overloaded user-defined
operators. This PR adds a test case for the same; the semantic check is
already existent.

Added: 
    flang/test/Semantics/OpenMP/atomic-update-overloaded-ops.f90

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/flang/test/Semantics/OpenMP/atomic-update-overloaded-ops.f90 b/flang/test/Semantics/OpenMP/atomic-update-overloaded-ops.f90
new file mode 100644
index 0000000000000..21a9b87d26345
--- /dev/null
+++ b/flang/test/Semantics/OpenMP/atomic-update-overloaded-ops.f90
@@ -0,0 +1,31 @@
+! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
+
+module new_operator
+    implicit none
+
+    interface operator(.MYOPERATOR.)
+       module procedure myprocedure
+    end interface
+contains
+    pure integer function myprocedure(param1, param2)
+        integer, intent(in) :: param1, param2
+        myprocedure = param1 + param2
+    end function
+end module
+
+program sample
+    use new_operator
+    implicit none
+    integer :: x, y 
+
+    !$omp atomic update
+        x = x / y
+     
+    !$omp atomic update
+    !ERROR: Invalid or missing operator in atomic update statement
+        x = x .MYOPERATOR. y
+
+    !$omp atomic
+    !ERROR: Invalid or missing operator in atomic update statement
+        x = x .MYOPERATOR. y
+end program


        


More information about the flang-commits mailing list