Files
gcc-reflection/libgomp/testsuite/libgomp.fortran/map-alloc-ptr-2.f90
supers1ngular 52d7f5b103 openmp: Bump Version from 4.5 to 5.2 (3/4)
Implements the OpenMP 5.2 Fortran deprecations. Uses the warning
established in patch 1/4, -Wdeprecated-openmp, for said deprecations.
Similarly, we do not implement the relaxing of constraints for the
interop construct since it is not a deprecation. However, the
deprecation for 'uses_allocators' is implemented, since support
exists in Fortran mainline. Additionally implements the
Fortran-specific deprecation for executable allocate directives,
and adds new tests.

gcc/fortran/ChangeLog:

	* openmp.cc (gfc_match_omp_clause_reduction): Deprecate '-'
	operator for reductions.
	(gfc_match_omp_clause_uses_allocators): Deprecate
	allocator(traits) pattern for 'uses_allocators'.
	(gfc_match_omp_clauses): Deprecate 'sink' and 'source' for
	'depend' clause. Deprecate list items as arguments with 'linear'
	clause. Deprecate non-comma-separated modifiers for the map
	clause. Deprecate 'to' clause with declare target.
	(gfc_match_omp_declare_target): Whitespace.
	(match_omp_metadirective): Deprecate 'default' clause on
	metadirectives.
	(resolve_omp_clauses): Deprecate executable allocate directives.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/allocate-8a.f90: Suppress warnings.
	* testsuite/libgomp.fortran/allocators-1.f90: Ditto.
	* testsuite/libgomp.fortran/allocators-2.f90: Ditto.
	* testsuite/libgomp.fortran/allocators-4.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-1.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-2.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-indirect-1.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-indirect-2.f90: Ditto.
	* testsuite/libgomp.fortran/doacross1.f90: Ditto.
	* testsuite/libgomp.fortran/doacross2.f90: Ditto.
	* testsuite/libgomp.fortran/doacross3.f90: Ditto.
	* testsuite/libgomp.fortran/map-alloc-ptr-2.f90: Ditto.
	* testsuite/libgomp.fortran/pr84418-1.f90: Ditto.
	* testsuite/libgomp.fortran/pr84418-2.f90: Ditto.
	* testsuite/libgomp.fortran/reduction1.f90: Ditto.
	* testsuite/libgomp.fortran/udr11.f90: Ditto.
	* testsuite/libgomp.fortran/uses_allocators_1.f90: Ditto.
	* testsuite/libgomp.fortran/uses_allocators_2.f90: Ditto.
	* testsuite/libgomp.fortran/dep-uses-allocators.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/allocate-14.f90: Suppress warnings.
	* gfortran.dg/gomp/allocate-16.f90: Ditto.
	* gfortran.dg/gomp/allocate-5.f90: Ditto.
	* gfortran.dg/gomp/allocate-6.f90: Ditto.
	* gfortran.dg/gomp/allocate-7.f90: Ditto.
	* gfortran.dg/gomp/allocators-3.f90: Ditto.
	* gfortran.dg/gomp/declare-simd-2.f90: Ditto.
	* gfortran.dg/gomp/declare-simd-6.f90: Ditto.
	* gfortran.dg/gomp/declare-target-1.f90: Ditto.
	* gfortran.dg/gomp/declare-target-2.f90: Ditto.
	* gfortran.dg/gomp/declare-target-4.f90: Ditto.
	* gfortran.dg/gomp/declare-target-5.f90: Ditto.
	* gfortran.dg/gomp/declare-target-indirect-1.f90: Ditto.
	* gfortran.dg/gomp/declare-target-indirect-2.f90: Ditto.
	* gfortran.dg/gomp/declare-variant-10.f90: Ditto.
	* gfortran.dg/gomp/declare-variant-8.f90: Ditto.
	* gfortran.dg/gomp/implicit-save.f90: Ditto.
	* gfortran.dg/gomp/linear-1.f90: Ditto.
	* gfortran.dg/gomp/linear-2.f90: Ditto.
	* gfortran.dg/gomp/linear-3.f90: Ditto.
	* gfortran.dg/gomp/linear-4.f90: Ditto.
	* gfortran.dg/gomp/linear-6.f90: Ditto.
	* gfortran.dg/gomp/map-12.f90: Ditto.
	* gfortran.dg/gomp/map-6.f90: Ditto.
	* gfortran.dg/gomp/map-7.f90: Ditto.
	* gfortran.dg/gomp/map-8.f90: Ditto.
	* gfortran.dg/gomp/order-8.f90: Ditto.
	* gfortran.dg/gomp/pr83977.f90: Ditto.
	* gfortran.dg/gomp/reduction1.f90: Ditto.
	* gfortran.dg/gomp/schedule-modifiers-2.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-55.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-56.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-57.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-58.f90: Ditto.
	* gfortran.dg/gomp/52-deps.f90: New test.
2025-12-11 08:12:50 -08:00

87 lines
2.4 KiB
Fortran

! { dg-do run }
! { dg-additional-options "-Wno-deprecated-openmp" }
! PR fortran/96668
module m
implicit none
integer, pointer :: p1(:) => null(), p3(:) => null()
integer, allocatable :: a1(:), a2(:)
!$omp declare target to(a1, a2, p1, p3)
end module m
use m
implicit none
integer, pointer :: p2(:)
!$omp target
if (allocated (a1)) stop 1
if (allocated (a2)) stop 1
if (associated (p1)) stop 1
if (associated (p3)) stop 1
!$omp end target
allocate (a1, source=[10,11,12,13,14])
allocate (a2, source=[10,11,12,13,14])
allocate (p1, source=[9,8,7,6,5,4])
allocate (p3, source=[4,5,6])
p2 => p1
!$omp target enter data map(to:p3)
! allocatable, TR9 requires 'always' modifier:
!$omp target map(always, tofrom: a1)
if (.not. allocated(a1)) stop 2
if (size(a1) /= 5) stop 3
if (any (a1 /= [10,11,12,13,14])) stop 5
a1(:) = [101, 102, 103, 104, 105]
!$omp end target
! allocatable, extension (OpenMP 6.0?): without 'always'
!$omp target
if (.not. allocated(a2)) stop 2
if (size(a2) /= 5) stop 3
if (any (a2 /= [10,11,12,13,14])) stop 5
a2(:) = [101, 102, 103, 104, 105]
!$omp end target
! pointer: target is automatically mapped
! without requiring an explicit mapping or even the always modifier
!$omp target !! map(always, tofrom: p1)
if (.not. associated(p1)) stop 7
if (size(p1) /= 6) stop 8
if (any (p1 /= [9,8,7,6,5,4])) stop 10
p1(:) = [-1, -2, -3, -4, -5, -6]
!$omp end target
!$omp target !! map(always, tofrom: p3)
if (.not. associated(p3)) stop 7
if (size(p3) /= 3) stop 8
if (any (p3 /= [4,5,6])) stop 10
p3(:) = [23,24,25]
!$omp end target
!$omp target update from(p1)
if (any (p1 /= [-1, -2, -3, -4, -5, -6])) stop 141
!$omp target exit data map(always, from:p3)
if (any (p3 /= [23,24,25])) stop 141
allocate (p1, source=[99,88,77,66,55,44,33])
!$omp target ! And this also should work
if (.not. associated(p1)) stop 7
if (size(p1) /= 7) stop 8
if (any (p1 /= [99,88,77,66,55,44,33])) stop 10
p1(:) = [-11, -22, -33, -44, -55, -66, -77]
!$omp end target
!$omp target update from(p1)
if (any (a1 /= [101, 102, 103, 104, 105])) stop 12
if (any (a2 /= [101, 102, 103, 104, 105])) stop 12
if (any (p1 /= [-11, -22, -33, -44, -55, -66, -77])) stop 142
if (any (p2 /= [-1, -2, -3, -4, -5, -6])) stop 143
deallocate(a1, a2, p1, p2, p3)
end