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

123 lines
4.7 KiB
Fortran

! RUN: %python %S/../test_errors.py %s %flang -fopenacc
! Same-kind data-sharing duplicates on an OpenACC directive (e.g.
! private(x, x), private(x) private(x), copyin(x, x) ...) are not errors:
! resolve-directives warns and rewrite-parse-tree drops the duplicate
! occurrences from the clause object lists. Cross-kind duplicates
! (e.g. private(x) firstprivate(x)) and reduction duplicates remain
! hard errors.
program test_dataclause_dedup
implicit none
integer :: x, y, z, i
! passThis1.f90 pattern: duplicate within a single PRIVATE clause.
!WARNING: 'x' appears more than once in the same kind of data-sharing clause on an OpenACC directive; duplicate ignored [-Wopenacc-usage]
!$acc parallel loop private(x, x)
do i = 1, 10
end do
! passThis2.f90 pattern: duplicate within a single PRIVATE clause across
! a continuation, with another variable in between.
!$acc parallel loop private(x, &
!WARNING: 'x' appears more than once in the same kind of data-sharing clause on an OpenACC directive; duplicate ignored [-Wopenacc-usage]
!$acc& y, x)
do i = 1, 10
end do
! passThis3.f90 pattern: duplicate across two separate PRIVATE clauses
! on the same directive.
!$acc parallel loop private(x) &
!WARNING: 'x' appears more than once in the same kind of data-sharing clause on an OpenACC directive; duplicate ignored [-Wopenacc-usage]
!$acc& private(y, x)
do i = 1, 10
end do
! Same patterns generalize to FIRSTPRIVATE.
!WARNING: 'x' appears more than once in the same kind of data-sharing clause on an OpenACC directive; duplicate ignored [-Wopenacc-usage]
!$acc parallel loop firstprivate(x, x)
do i = 1, 10
end do
!WARNING: 'x' appears more than once in the same kind of data-sharing clause on an OpenACC directive; duplicate ignored [-Wopenacc-usage]
!$acc parallel loop firstprivate(x) firstprivate(y, x)
do i = 1, 10
end do
! Multiple distinct duplicates on a single directive.
!WARNING: 'x' appears more than once in the same kind of data-sharing clause on an OpenACC directive; duplicate ignored [-Wopenacc-usage]
!WARNING: 'y' appears more than once in the same kind of data-sharing clause on an OpenACC directive; duplicate ignored [-Wopenacc-usage]
!$acc parallel loop private(x, y, x, y)
do i = 1, 10
end do
! Triple occurrence: two duplicates, both warned, only one survives dedup.
!WARNING: 'x' appears more than once in the same kind of data-sharing clause on an OpenACC directive; duplicate ignored [-Wopenacc-usage]
!WARNING: 'x' appears more than once in the same kind of data-sharing clause on an OpenACC directive; duplicate ignored [-Wopenacc-usage]
!$acc parallel loop private(x, x, x)
do i = 1, 10
end do
! Cross-kind duplicates on the same directive remain hard errors.
!ERROR: 'x' appears in more than one data-sharing clause on the same OpenACC directive
!$acc parallel loop private(x) firstprivate(x)
do i = 1, 10
end do
! Reduction is excluded from the benign case: same-flag duplicates may
! differ in operator, which is a real conflict.
!ERROR: 'x' appears in more than one data-sharing clause on the same OpenACC directive
!$acc parallel loop reduction(+:x) reduction(*:x)
do i = 1, 10
end do
! Regression coverage for non-bare designators: the dedup machinery only
! examines simple-Name DataRefs, so distinct array elements and array
! sections must pass through untouched, with no warning and no erasure.
block
integer :: arr(10)
integer, target :: t1, t2
integer, pointer :: p
type :: pt
integer :: a
integer :: b
end type
type(pt) :: s
! Different array elements -- not duplicates.
!$acc parallel loop private(arr(1), arr(2))
do i = 1, 10
end do
! Different array sections -- not duplicates.
!$acc parallel loop private(arr(1:5), arr(6:10))
do i = 1, 10
end do
! Same array element listed twice -- not deduped, since GetDesignatorName-
! IfDataRef returns null for ArrayElement and CheckMultipleAppearances
! is never invoked. Compiles without diagnostics.
!$acc parallel loop private(arr(1), arr(1))
do i = 1, 10
end do
! Same array section listed twice -- same reasoning, no diagnostic.
!$acc parallel loop private(arr(1:5), arr(1:5))
do i = 1, 10
end do
! Distinct structure components -- not duplicates.
!$acc parallel loop private(s%a, s%b)
do i = 1, 10
end do
! Mixing a bare-name designator and an array-element designator on the
! same symbol must not trigger dedup -- the array element doesn't go
! through the duplicate check at all.
!$acc parallel loop private(arr, arr(1))
do i = 1, 10
end do
end block
end program