aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/append-args-interop.f9028
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90 b/gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90
new file mode 100644
index 0000000..540079a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90
@@ -0,0 +1,28 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-gimple" }
+
+! Test that interop objects are implicitly created/destroyed when a dispatch
+! construct doesn't provide enough of them to satisfy the declare variant
+! append_args clause.
+
+module m
+ use iso_c_binding, only: c_intptr_t
+ integer, parameter :: omp_interop_kind = c_intptr_t
+contains
+subroutine g(x,y,z)
+ integer(omp_interop_kind) :: x, y, z
+ value :: y
+end
+subroutine f()
+ !$omp declare variant(f: g) append_args(interop(target), interop(prefer_type("cuda","hip"), targetsync), interop(target,targetsync,prefer_type({attr("ompx_foo")}))) match(construct={dispatch})
+end
+end
+
+use m
+!$omp dispatch device(99)
+ call f()
+end
+
+! { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(99, 3, &interopobjs\.\[0-9\]+, &tgt_tgtsync\.\[0-9\]+, &pref_type\.\[0-9\]+, " "gimple" } }
+! { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(99, 0, 0B, 0B, 0B, 0, 0B, 3, &interopobjs\.\[0-9\]+," "gimple" } }
+! { dg-final { scan-tree-dump "g \\(&interop\.\[0-9\]+, interop\.\[0-9\]+, &interop\.\[0-9\]+\\)" "gimple" } }