From 59c6c5dbf267cd9d0a8df72b2a5eb5657b64268e Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 14 Oct 2022 17:36:51 +0200
Subject: [PATCH] Add 'libgomp.oacc-fortran/declare-allocatable-1-runtime.f90'
... which is 'libgomp.oacc-fortran/declare-allocatable-1.f90' adjusted
for missing support for OpenACC "Changes from Version 2.0 to 2.5":
"The 'declare create' directive with a Fortran 'allocatable' has new behavior".
Thus, after 'allocate'/before 'deallocate', call 'acc_create'/'acc_delete'
manually.
libgomp/
* testsuite/libgomp.oacc-fortran/declare-allocatable-1-runtime.f90:
New.
---
...ble-1.f90 => declare-allocatable-1-runtime.f90} | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
copy libgomp/testsuite/libgomp.oacc-fortran/{declare-allocatable-1.f90 => declare-allocatable-1-runtime.f90} (96%)
similarity index 96%
copy from libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1.f90
copy to libgomp/testsuite/libgomp.oacc-fortran/declare-allocatable-1-runtime.f90
@@ -3,10 +3,10 @@
! { dg-do run }
!TODO-OpenACC-declare-allocate
-! Not currently implementing correct '-DACC_MEM_SHARED=0' behavior:
! Missing support for OpenACC "Changes from Version 2.0 to 2.5":
! "The 'declare create' directive with a Fortran 'allocatable' has new behavior".
-! { dg-xfail-run-if TODO { *-*-* } { -DACC_MEM_SHARED=0 } }
+! Thus, after 'allocate'/before 'deallocate', call 'acc_create'/'acc_delete'
+! manually.
!TODO { dg-additional-options -fno-inline } for stable results regarding OpenACC 'routine'.
@@ -67,6 +67,7 @@ program test
! Test local usage of an allocated declared array.
allocate (b(n))
+ call acc_create (b)
if (.not.allocated (b)) error stop
if (.not.acc_is_present (b)) error stop
@@ -91,12 +92,14 @@ program test
if (b(i) /= i*a) error stop
end do
+ call acc_delete (b)
deallocate (b)
! Test the usage of an allocated declared array inside an acc
! routine subroutine.
allocate (b(n))
+ call acc_create (b)
if (.not.allocated (b)) error stop
if (.not.acc_is_present (b)) error stop
@@ -114,6 +117,7 @@ program test
if (b(i) /= i*2) error stop
end do
+ call acc_delete (b)
deallocate (b)
! Test the usage of an allocated declared array inside a host
@@ -129,6 +133,7 @@ program test
if (b(i) /= 1.0) error stop
end do
+ call acc_delete (b)
deallocate (b)
if (allocated (b)) error stop
@@ -137,6 +142,7 @@ program test
! routine function.
allocate (b(n))
+ call acc_create (b)
if (.not.allocated (b)) error stop
if (.not.acc_is_present (b)) error stop
@@ -170,12 +176,14 @@ program test
if (b(i) /= i) error stop
end do
+ call acc_delete (b)
deallocate (b)
! Test the usage of an allocated declared array inside a host
! function.
allocate (b(n))
+ call acc_create (b)
if (.not.allocated (b)) error stop
if (.not.acc_is_present (b)) error stop
@@ -202,6 +210,7 @@ program test
if (b(i) /= i*i) error stop
end do
+ call acc_delete (b)
deallocate (b)
end program test ! { dg-line l[incr c] }
! { dg-bogus {note: variable 'overflow\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} {TODO n/a} { xfail *-*-* } l$c }
@@ -234,6 +243,7 @@ subroutine sub2
integer i
allocate (b(n))
+ call acc_create (b)
if (.not.allocated (b)) error stop
if (.not.acc_is_present (b)) error stop
--
2.35.1