Skip to content

Commit

Permalink
[flang][OpenMP] Add test for checking overloaded operator in atomic u…
Browse files Browse the repository at this point in the history
…pdate (llvm#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.
  • Loading branch information
NimishMishra committed May 16, 2024
1 parent 74a8754 commit d94582e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions flang/test/Semantics/OpenMP/atomic-update-overloaded-ops.f90
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d94582e

Please sign in to comment.