[Patch][OpenMP][Fortran] Support absent optional args with use_device_{ptr,addr} (+ OpenACC's use_device clause)

Thomas Schwinge thomas@codesourcery.com
Mon Nov 11 12:51:00 GMT 2019


Hi Tobias!

Thanks for looking into this mess ;-) of Fortran optional arguments
support for OMP, based on what Kwok has already developed.


On 2019-11-08T16:41:23+0100, Tobias Burnus <tobias@codesourcery.com> wrote:
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.fortran/use_device_ptr-optional-2.f90

When adding '{ dg-do run }' for torture testing (please remember to), I
see the '-O0' and '-O1' execution testing FAIL, complaining that
"libgomp: use_device_ptr pointer wasn't mapped".


Grüße
 Thomas


> @@ -0,0 +1,33 @@
> +! Check whether absent optional arguments are properly
> +! handled with use_device_{addr,ptr}.
> +program main
> + implicit none (type, external)
> + call foo()
> +contains
> +  subroutine foo(v, w, x, y, z)
> +    integer, target, optional, value :: v
> +    integer, target, optional :: w
> +    integer, target, optional :: x(:)
> +    integer, target, optional, allocatable :: y
> +    integer, target, optional, allocatable :: z(:)
> +    integer :: d
> +
> +    !$omp target data map(d) use_device_addr(v, w, x, y, z)
> +      if(present(v)) stop 1
> +      if(present(w)) stop 2
> +      if(present(x)) stop 3
> +      if(present(y)) stop 4
> +      if(present(z)) stop 5
> +    !$omp end target data
> +
> +! Using 'v' in use_device_ptr gives an ICE
> +! TODO: Find out what the OpenMP spec permits for use_device_ptr
> +
> +    !$omp target data map(d) use_device_ptr(w, x, y, z)
> +      if(present(w)) stop 6
> +      if(present(x)) stop 7
> +      if(present(y)) stop 8
> +      if(present(z)) stop 9
> +    !$omp end target data
> +  end subroutine foo
> +end program main
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 658 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191111/6c5a7b91/attachment.sig>


More information about the Gcc-patches mailing list