Files
TheRock/compiler/amd-llvm/flang/test/Semantics/OpenMP/atomic-mem-order.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

96 lines
2.1 KiB
Fortran

! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=51
! Semantic checks for incompatible memory orderings on atomic operations.
subroutine test_atomic_read_mem_order()
integer :: x, v
! Valid orderings for read
!$omp atomic read seq_cst
v = x
!$omp atomic read acquire
v = x
!$omp atomic read relaxed
v = x
! Invalid orderings for read
!WARNING: An ATOMIC READ operation must not have RELEASE as the memory order, using RELAXED
!$omp atomic read release
v = x
!$omp atomic read acq_rel
v = x
end subroutine
subroutine test_atomic_write_mem_order()
integer :: x, v
! Valid orderings for write
!$omp atomic write seq_cst
x = v
!$omp atomic write release
x = v
!$omp atomic write relaxed
x = v
! Invalid orderings for write
!WARNING: An ATOMIC WRITE operation must not have ACQUIRE as the memory order, using RELAXED
!$omp atomic write acquire
x = v
!$omp atomic write acq_rel
x = v
end subroutine
subroutine test_atomic_update_mem_order()
integer :: x
! Valid orderings for update
!$omp atomic update seq_cst
x = x + 1
!$omp atomic update release
x = x + 1
!$omp atomic update relaxed
x = x + 1
! No restrictions on update in OpenMP 5.1
!$omp atomic update acquire
x = x + 1
!$omp atomic update acq_rel
x = x + 1
end subroutine
subroutine test_atomic_capture_mem_order()
integer :: x, v
! Valid orderings for capture (all are allowed, but some produce warnings)
!$omp atomic capture seq_cst
v = x
x = x + 1
!$omp end atomic
!$omp atomic capture acquire
v = x
x = x + 1
!$omp end atomic
!$omp atomic capture relaxed
v = x
x = x + 1
!$omp end atomic
! Capture with release/acq_rel: valid, no restrictions
!$omp atomic capture release
v = x
x = x + 1
!$omp end atomic
!$omp atomic capture acq_rel
v = x
x = x + 1
!$omp end atomic
! Trigger an error so test_errors.py captures stderr
!ERROR: ATOMIC READ cannot have COMPARE or CAPTURE clauses
!$omp atomic read capture
v = x
x = x + 1
!$omp end atomic
end subroutine