Files
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
4.2 KiB
Fortran

! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
! Semantic checks for various assignments related to atomic constructs
program sample
use omp_lib
integer :: x, v
integer :: y(10)
integer, allocatable :: k
integer a(10)
type sample_type
integer :: y
integer :: m
endtype
type(sample_type) :: z
character :: l, r
!$omp atomic read
v = x
!$omp atomic read
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)
!ERROR: Atomic variable y(1_8:3_8:1_8) should be a scalar
v = y(1:3)
!$omp atomic read
!ERROR: Atomic expression x*(10_4+x) should be a variable
v = x * (10 + x)
!$omp atomic read
!ERROR: Atomic expression 4_4 should be a variable
v = 4
!$omp atomic read
!ERROR: Atomic variable k cannot be ALLOCATABLE
v = k
!$omp atomic write
!ERROR: Atomic variable k cannot be ALLOCATABLE
k = x
!$omp atomic update
!ERROR: Atomic variable k cannot be ALLOCATABLE
k = k + x * (v * x)
!$omp atomic
!ERROR: Atomic variable k cannot be ALLOCATABLE
k = v * k
!$omp atomic write
!ERROR: Within atomic operation z%y and x+z%y access the same storage
z%y = x + z%y
!$omp atomic write
!ERROR: Within atomic operation x and x access the same storage
x = x
!$omp atomic write
!ERROR: Within atomic operation m and min(m,x,z%m)+k access the same storage
m = min(m, x, z%m) + k
!$omp atomic read
!ERROR: Within atomic operation x and x access the same storage
x = x
!$omp atomic read
!ERROR: Atomic expression min(m,x,z%m)+k should be a variable
m = min(m, x, z%m) + k
!$omp atomic read
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)
!ERROR: Atomic variable a should be a scalar
x = a
!$omp atomic write
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)
x = a
!$omp atomic write
!ERROR: Atomic variable a should be a scalar
a = x
!$omp atomic capture
v = x
x = x + 1
!$omp end atomic
!$omp atomic release capture
v = x
! This ends up being "x = b + x".
x = b + (x*1)
!$omp end atomic
!$omp atomic capture hint(0)
v = x
x = 1
!$omp end atomic
!$omp atomic capture
!ERROR: In ATOMIC UPDATE operation with CAPTURE the right-hand side of the capture assignment should read b
v = x
b = b + 1
!$omp end atomic
!$omp atomic capture
!ERROR: In ATOMIC UPDATE operation with CAPTURE the right-hand side of the capture assignment should read b
v = x
b = 10
!$omp end atomic
!$omp atomic capture
x = x + 10
!ERROR: In ATOMIC UPDATE operation with CAPTURE the right-hand side of the capture assignment should read x
v = b
!$omp end atomic
!ERROR: In ATOMIC UPDATE operation with CAPTURE neither statement could be the update or the capture
!$omp atomic capture
v = 1
x = 4
!$omp end atomic
!$omp atomic capture
!ERROR: In ATOMIC UPDATE operation with CAPTURE the right-hand side of the capture assignment should read z%m
x = z%y
z%m = z%m + 1.0
!$omp end atomic
!$omp atomic capture
z%m = z%m + 1.0
!ERROR: In ATOMIC UPDATE operation with CAPTURE the right-hand side of the capture assignment should read z%m
x = z%y
!$omp end atomic
!$omp atomic capture
!ERROR: In ATOMIC UPDATE operation with CAPTURE the right-hand side of the capture assignment should read y(1_8)
x = y(2)
y(1) = y(1) + 1
!$omp end atomic
!$omp atomic capture
y(1) = y(1) + 1
!ERROR: In ATOMIC UPDATE operation with CAPTURE the right-hand side of the capture assignment should read y(1_8)
x = y(2)
!$omp end atomic
!$omp atomic read
!ERROR: Atomic variable r cannot have CHARACTER type
l = r
!$omp atomic write
!ERROR: Atomic variable l cannot have CHARACTER type
l = r
end program