Files
Thomas Schwinge 954f804b73 openmp: Bump Version from 4.5 to 5.2 (2/4): Some more '-Wno-deprecated-openmp'
These changes should've been included in
commit 382edf047e
"openmp: Bump Version from 4.5 to 5.2 (2/4)", to avoid some more instances of:

    warning: use of 'omp declare target' as a synonym for 'omp begin declare target' has been deprecated since OpenMP 5.2 [-Wdeprecated-openmp]

    warning: 'to' clause with 'declare target' deprecated since OpenMP 5.2, use 'enter' [-Wdeprecated-openmp]

    Warning: Non-C_PTR type argument at (1) is deprecated, use HAS_DEVICE_ADDR [-Wdeprecated-openmp]

    Warning: 'to' clause with 'declare target' at (1) deprecated since OpenMP 5.2, use 'enter' [-Wdeprecated-openmp]

	libgomp/
	* testsuite/libgomp.c++/examples-4/declare_target-2.C: Add
	'-Wno-deprecated-openmp'.
	* testsuite/libgomp.c/declare-variant-3-sm30.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm35.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm37.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm52.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm53.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm61.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm70.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm75.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm80.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm89.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c:
	Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1030.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1031.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1032.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1033.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1034.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1035.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1036.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx11-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1100.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1101.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1102.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1103.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1150.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1151.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1152.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1153.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c:
	Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx9-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx900.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx902.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx904.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx906.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx908.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx909.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx90a.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx90c.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx942.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx950.c: Likewise.
	* testsuite/libgomp.c/examples-4/async_target-2.c: Likewise.
	* testsuite/libgomp.c/interop-hsa.c: Likewise.
	* testsuite/libgomp.c/target-20.c: Likewise.
	* testsuite/libgomp.c/target-simd-clone-1.c: Likewise.
	* testsuite/libgomp.c/target-simd-clone-2.c: Likewise.
	* testsuite/libgomp.c/target-simd-clone-3.c: Likewise.
	* testsuite/libgomp.fortran/alloc-managed-1.f90: Likewise.
	* testsuite/libgomp.fortran/target9.f90: Likewise.
2026-01-13 11:08:34 +01:00

126 lines
2.8 KiB
Fortran

! { dg-do run }
! { dg-require-effective-target offload_device_nonshared_as } */
! { dg-additional-options -Wno-deprecated-openmp }
module target_test
implicit none (type, external)
integer, parameter :: N = 40
integer :: sum
integer :: var1 = 1
integer :: var2 = 2
!$omp declare target to(D)
integer :: D(N) = 0
contains
subroutine enter_data (X)
integer :: X(:)
!$omp target enter data map(to: var1, var2, X) map(alloc: sum)
end subroutine enter_data
subroutine exit_data_0 (D)
integer :: D(N)
!$omp target exit data map(delete: D)
end subroutine exit_data_0
subroutine exit_data_1 ()
!$omp target exit data map(from: var1)
end subroutine exit_data_1
subroutine exit_data_2 (X)
integer :: X(N)
!$omp target exit data map(from: var2) map(release: X, sum)
end subroutine exit_data_2
subroutine exit_data_3 (p, idx)
integer :: p(:)
integer, value :: idx
!$omp target exit data map(from: p(idx))
end subroutine exit_data_3
subroutine test_nested ()
integer :: X, Y, Z
X = 0
Y = 0
Z = 0
!$omp target data map(from: X, Y, Z)
!$omp target data map(from: X, Y, Z)
!$omp target map(from: X, Y, Z)
X = 1337
Y = 1337
Z = 1337
!$omp end target
if (X /= 0) stop 11
if (Y /= 0) stop 12
if (Z /= 0) stop 13
!$omp target exit data map(from: X) map(release: Y)
if (X /= 0) stop 14
if (Y /= 0) stop 15
!$omp target exit data map(release: Y) map(delete: Z)
if (Y /= 0) stop 16
if (Z /= 0) stop 17
!$omp end target data
if (X /= 1337) stop 18
if (Y /= 0) stop 19
if (Z /= 0) stop 20
!$omp target map(from: X)
X = 2448
!$omp end target
if (X /= 2448) stop 21
if (Y /= 0) stop 22
if (Z /= 0) stop 23
X = 4896
!$omp end target data
if (X /= 4896) stop 24
if (Y /= 0) stop 25
if (Z /= 0) stop 26
end subroutine test_nested
end module target_test
program main
use target_test
implicit none (type, external)
integer, allocatable :: X(:)
integer, pointer, contiguous :: Y(:)
allocate(X(N), Y(N))
X(10) = 10
Y(20) = 20
call enter_data (X)
call exit_data_0 (D) ! This should have no effect on D.
!$omp target map(alloc: var1, var2, X) map(to: Y) map(always, from: sum)
var1 = var1 + X(10)
var2 = var2 + Y(20)
sum = var1 + var2
D(sum) = D(sum) + 1
!$omp end target
if (var1 /= 1) stop 1
if (var2 /= 2) stop 2
if (sum /= 33) stop 3
call exit_data_1 ()
if (var1 /= 11) stop 4
if (var2 /= 2) stop 5
! Increase refcount of already mapped X(1:N).
!$omp target enter data map(alloc: X(16:17))
call exit_data_2 (X)
if (var2 /= 22) stop 6
call exit_data_3 (X, 5) ! Unmap X(1:N).
deallocate (X, Y)
call test_nested ()
end program main