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

89 lines
2.7 KiB
Fortran

! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.1
! Check OpenMP construct validity for the following directives:
! 2.21.2 Threadprivate Directive
program threadprivate02
integer :: arr1(10)
common /blk1/ a1
real, save :: eq_a, eq_b, eq_c, eq_d
integer :: eq_e, eq_f
equivalence(eq_e, eq_f)
common /blk2/ eq_e
!$omp threadprivate(arr1)
!$omp threadprivate(/blk1/)
!$omp threadprivate(blk1)
!ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block
!$omp threadprivate(a1)
equivalence(eq_a, eq_b)
!ERROR: A variable in a THREADPRIVATE directive cannot appear in an EQUIVALENCE statement
!$omp threadprivate(eq_a)
!ERROR: A variable in a THREADPRIVATE directive cannot appear in an EQUIVALENCE statement
!$omp threadprivate(eq_c)
equivalence(eq_c, eq_d)
! This is an extension to the OpenMP semantics, see https://github.com/llvm/llvm-project/issues/180493
!WARNING: A variable in a THREADPRIVATE directive used in an EQUIVALENCE statement is an OpenMP extension (variable 'eq_e' from common block '/blk2/') [-Wopenmp-threadprivate-equivalence]
!$omp threadprivate(/blk2/)
contains
subroutine func()
integer :: arr2(10)
integer, save :: arr3(10)
common /blk2/ a2
common /blk3/ a3
save /blk3/
!ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp threadprivate(arr2)
!$omp threadprivate(arr3)
!$omp threadprivate(/blk2/)
!ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block
!$omp threadprivate(a2)
!$omp threadprivate(/blk3/)
!ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block
!$omp threadprivate(a3)
end
end
module mod4
integer :: arr4(10)
common /blk4/ a4
!$omp threadprivate(arr4)
!$omp threadprivate(/blk4/)
!$omp threadprivate(blk4)
!ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block
!$omp threadprivate(a4)
end
subroutine func5()
integer :: arr5(10)
common /blk5/ a5
!ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp threadprivate(arr5)
!$omp threadprivate(/blk5/)
!ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp threadprivate(blk5)
!ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block
!$omp threadprivate(a5)
end