Files
TheRock/compiler/amd-llvm/flang/test/Semantics/OpenMP/atomic03.f90
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

140 lines
3.9 KiB
Fortran

! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Atomic construct
! section 2.17.7
! Intrinsic procedure name is one of MAX, MIN, IAND, IOR, or IEOR.
program OmpAtomic
use omp_lib
real x
integer :: y, z, a, b, c, d
x = 5.73
y = 3
z = 1
!$omp atomic
y = IAND(y, 4)
!$omp atomic
y = IOR(y, 5)
!$omp atomic
y = IEOR(y, 6)
!$omp atomic
y = MAX(y, 7)
!$omp atomic
y = MIN(y, 8)
!$omp atomic
!ERROR: The atomic variable z should appear as an argument of the top-level AND operator
z = IAND(y, 4)
!$omp atomic
!ERROR: The atomic variable z should appear as an argument of the top-level OR operator
z = IOR(y, 5)
!$omp atomic
!ERROR: The atomic variable z should appear as an argument of the top-level NEQV/EOR operator
z = IEOR(y, 6)
!$omp atomic
!ERROR: The atomic variable z should appear as an argument of the top-level MAX operator
z = MAX(y, 7, b, c)
!$omp atomic
!ERROR: The atomic variable z should appear as an argument of the top-level MIN operator
z = MIN(y, 8, a, d)
!$omp atomic
!ERROR: This intrinsic function is not a valid ATOMIC UPDATE operation
y = FRACTION(x)
!$omp atomic
!ERROR: The atomic variable y should appear as an argument in the update operation
y = REAL(x)
!$omp atomic update
y = IAND(y, 4)
!$omp atomic update
y = IOR(y, 5)
!$omp atomic update
y = IEOR(y, 6)
!$omp atomic update
y = MAX(y, 7)
!$omp atomic update
y = MIN(y, 8)
!$omp atomic update
!ERROR: The atomic variable z should appear as an argument of the top-level AND operator
z = IAND(y, 4)
!$omp atomic update
!ERROR: The atomic variable z should appear as an argument of the top-level OR operator
z = IOR(y, 5)
!$omp atomic update
!ERROR: The atomic variable z should appear as an argument of the top-level NEQV/EOR operator
z = IEOR(y, 6)
!$omp atomic update
!ERROR: The atomic variable z should appear as an argument of the top-level MAX operator
z = MAX(y, 7)
!$omp atomic update
!ERROR: The atomic variable z should appear as an argument of the top-level MIN operator
z = MIN(y, 8)
!$omp atomic update
!ERROR: This intrinsic function is not a valid ATOMIC UPDATE operation
y = MOD(y, 9)
!$omp atomic update
!ERROR: This intrinsic function is not a valid ATOMIC UPDATE operation
x = ABS(x)
end program OmpAtomic
subroutine conflicting_types()
type simple
integer :: z
end type
real x
integer :: y, z
type(simple) ::s
z = 1
!$omp atomic
!ERROR: The atomic variable z should appear as an argument of the top-level AND operator
z = IAND(s%z, 4)
end subroutine
subroutine more_invalid_atomic_update_stmts()
integer :: a, b
integer :: k(10)
type some_type
integer :: m(10)
end type
type(some_type) :: s
!$omp atomic update
!ERROR: The atomic variable a should be exactly one of the arguments of the top-level MIN operator
a = min(a, a, b)
!$omp atomic
!ERROR: The atomic variable a should be exactly one of the arguments of the top-level MAX operator
a = max(b, a, b, a)
!$omp atomic
a = min(b, a, b)
!$omp atomic
!ERROR: The atomic variable a should be exactly one of the arguments of the top-level MAX operator
a = max(b, a, b, a, b)
!$omp atomic update
!ERROR: The atomic variable y should appear as an argument of the top-level MIN operator
y = min(z, x)
!$omp atomic
z = max(z, y)
!$omp atomic update
!ERROR: Atomic variable k should be a scalar
!ERROR: The atomic variable k should appear as an argument of the top-level MAX operator
k = max(x, y)
!$omp atomic
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar REAL(4) and rank 1 array of REAL(4)
x = min(x, k)
!$omp atomic
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar REAL(4) and rank 1 array of REAL(4)
z = z + s%m
end subroutine