Files
TheRock/compiler/amd-llvm/flang/test/Semantics/OpenACC/acc-atomic-validity.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

155 lines
3.2 KiB
Fortran

! RUN: %python %S/../test_errors.py %s %flang -fopenacc
! Check OpenACC clause validity for the following construct and directive:
! 2.12 Atomic
program openacc_atomic_validity
implicit none
integer :: i
integer, parameter :: N = 256
integer, dimension(N) :: c
logical :: l
!$acc parallel
!$acc atomic update
c(i) = c(i) + 1
!$acc atomic update
c(i) = c(i) + 1
!$acc end atomic
!$acc atomic write
c(i) = 10
!$acc atomic write if(l)
c(i) = 10
!$acc atomic write
c(i) = 10
!$acc end atomic
!$acc atomic write if(.true.)
c(i) = 10
!$acc end atomic
!$acc atomic read
i = c(i)
!$acc atomic read if(.true.)
i = c(i)
!$acc atomic read
i = c(i)
!$acc end atomic
!$acc atomic read if(l)
i = c(i)
!$acc end atomic
!ERROR: FINALIZE clause is not allowed on the ATOMIC READ FINALIZE IF(L)
!$acc atomic read finalize if(l)
i = c(i)
!$acc end atomic
!TODO: Should error because c(i) references i which is the atomic update variable.
!$acc atomic capture
c(i) = i
i = i + 1
!$acc end atomic
!ERROR: The variables assigned in this atomic capture construct must be distinct
!$acc atomic capture
c(1) = c(2)
c(1) = c(3)
!$acc end atomic
!ERROR: The assignments in this atomic capture construct do not update a variable and capture either its initial or final value
!$acc atomic capture
c(1) = c(2)
c(2) = c(2)
!$acc end atomic
!ERROR: The assignments in this atomic capture construct do not update a variable and capture either its initial or final value
!$acc atomic capture
c(1) = c(2)
c(2) = c(1)
!$acc end atomic
!ERROR: The assignments in this atomic capture construct do not update a variable and capture either its initial or final value
!$acc atomic capture
c(1) = c(2)
c(3) = c(2)
!$acc end atomic
!$acc atomic capture if(l .EQV. .false.)
c(i) = i
i = i + 1
!$acc end atomic
!$acc atomic update
!ERROR: RHS of atomic update statement must be scalar
!ERROR: LHS of atomic update statement must be scalar
c = c + 1
!$acc atomic update if(i == 0)
c(i) = c(i) + 1
!ERROR: At most one IF clause can appear on the ATOMIC UPDATE IF(I == 0) IF(.TRUE.)
!$acc atomic update if(i == 0) if(.true.)
c(i) = c(i) + 1
!$acc end parallel
!ERROR: COPY clause is not allowed on the ATOMIC UPDATE COPY(I)
!$acc atomic update copy(i)
c(i) = c(i) + 1
end program openacc_atomic_validity
subroutine capture_with_convert_f64_to_i32()
integer :: x
real(8) :: v, w
x = 1
v = 0
w = 2
!$acc atomic capture
x = x * 2.5_8
v = x
!$acc end atomic
!$acc atomic capture
!TODO: The rhs side of this update statement cannot reference v.
x = x * v
v = x
!$acc end atomic
!$acc atomic capture
!TODO: The rhs side of this update statement cannot reference v.
x = v * x
v = x
!$acc end atomic
!$acc atomic capture
!ERROR: The RHS of this atomic update statement must reference the updated variable: x
x = v * v
v = x
!$acc end atomic
!$acc atomic capture
x = v
!ERROR: The updated variable, v, cannot appear more than once in the atomic update operation
v = v * v
!$acc end atomic
!$acc atomic capture
v = x
x = w * w
!$acc end atomic
end subroutine capture_with_convert_f64_to_i32