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
102 lines
2.3 KiB
Fortran
102 lines
2.3 KiB
Fortran
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
|
|
|
|
! OpenMP 5.2 §7.8.2: The bare form of DECLARE TARGET (without arguments or
|
|
! clauses) is only permitted in the specification part of a subroutine,
|
|
! function, or interface body.
|
|
|
|
block data foo
|
|
implicit none
|
|
integer :: x
|
|
common /blk/ x
|
|
!ERROR: DECLARE TARGET directive without arguments or clauses must appear in a subroutine or function
|
|
!$omp declare target
|
|
data x /42/
|
|
end block data
|
|
|
|
program main
|
|
implicit none
|
|
integer :: a
|
|
!ERROR: DECLARE TARGET directive without arguments or clauses must appear in a subroutine or function
|
|
!$omp declare target
|
|
a = 1
|
|
end program
|
|
|
|
! Valid: bare form in a subroutine
|
|
subroutine sub1()
|
|
implicit none
|
|
integer :: b
|
|
!$omp declare target
|
|
b = 2
|
|
end subroutine
|
|
|
|
! Valid: bare form in a function
|
|
integer function func1()
|
|
!$omp declare target
|
|
func1 = 3
|
|
end function
|
|
|
|
module mod1
|
|
implicit none
|
|
integer :: c
|
|
!ERROR: DECLARE TARGET directive without arguments or clauses must appear in a subroutine or function
|
|
!$omp declare target
|
|
end module
|
|
|
|
module parent_mod
|
|
implicit none
|
|
integer :: d
|
|
end module
|
|
|
|
submodule (parent_mod) child_sub
|
|
integer :: e
|
|
!ERROR: DECLARE TARGET directive without arguments or clauses must appear in a subroutine or function
|
|
!$omp declare target
|
|
end submodule
|
|
|
|
! Valid: bare form inside a separate module subprogram (MODULE PROCEDURE)
|
|
module mod_with_proc
|
|
interface
|
|
module subroutine mod_sub()
|
|
end subroutine
|
|
end interface
|
|
end module
|
|
|
|
submodule (mod_with_proc) mod_with_proc_impl
|
|
contains
|
|
module procedure mod_sub
|
|
!$omp declare target
|
|
end procedure
|
|
end submodule
|
|
|
|
! Valid: bare form inside an interface body in a module
|
|
module mod_with_interface
|
|
interface
|
|
subroutine interface_sub()
|
|
!$omp declare target
|
|
end subroutine
|
|
end interface
|
|
end module
|
|
|
|
! Invalid: bare form inside a BLOCK construct (even within a subroutine)
|
|
subroutine sub_with_block()
|
|
implicit none
|
|
integer :: outer
|
|
!$omp declare target
|
|
block
|
|
integer :: inner
|
|
!ERROR: DECLARE TARGET directive without arguments or clauses must appear in a subroutine or function
|
|
!$omp declare target
|
|
end block
|
|
outer = 1
|
|
end subroutine
|
|
|
|
! Valid: empty BLOCK in subroutine does not cause false positive
|
|
subroutine sub_empty_block()
|
|
implicit none
|
|
integer :: x
|
|
!$omp declare target
|
|
block
|
|
end block
|
|
x = 1
|
|
end subroutine
|