1 extern void abort (void);
3 __attribute__((noinline
, noclone
)) void
4 foo (int *p
, int *q
, int *r
, int n
, int m
)
8 #pragma omp target map(to:sep)
10 #pragma omp target data map(to:p[0:8])
12 /* For zero length array sections, p points to the start of
13 already mapped range, q to the end of it (with nothing mapped
14 after it), and r does not point to an mapped range. */
15 #pragma omp target map(alloc:p[:0]) map(to:q[:0]) map(from:r[:0]) private(i) map(from:err) firstprivate (s)
18 for (i
= 0; i
< 8; i
++)
23 /* Since OpenMP 5.2, 'q'/'r' are no longer set to NULL if pointing to
25 if (q
== (int *) 0 || r
== (int *) 0)
28 else if (p
+ 8 != q
|| r
!= s
)
33 /* Implicit mapping of pointers behaves the same way. */
34 #pragma omp target private(i) map(from:err) firstprivate (s)
37 for (i
= 0; i
< 8; i
++)
42 /* Since OpenMP 5.2, 'q'/'r' are no longer set to NULL if pointing to
44 if (q
== (int *) 0 || r
== (int *) 0)
47 else if (p
+ 8 != q
|| r
!= s
)
52 /* And zero-length array sections, though not known at compile
53 time, behave the same. */
54 #pragma omp target map(p[:n]) map(tofrom:q[:n]) map(alloc:r[:n]) private(i) map(from:err) firstprivate (s)
57 for (i
= 0; i
< 8; i
++)
62 /* Since OpenMP 5.2, 'q'/'r' are no longer set to NULL if pointing to
64 if (q
== (int *) 0 || r
== (int *) 0)
67 else if (p
+ 8 != q
|| r
!= s
)
72 /* Non-zero length array sections, though not known at compile,
73 behave differently. */
74 #pragma omp target map(p[:m]) map(tofrom:q[:m]) map(to:r[:m]) private(i) map(from:err)
77 for (i
= 0; i
< 8; i
++)
80 if (q
[0] != 9 || r
[0] != 10)
85 #pragma omp target data map(to:q[0:1])
87 /* For zero length array sections, p points to the start of
88 already mapped range, q points to the start of another one,
89 and r to the end of the second one. */
90 #pragma omp target map(to:p[:0]) map(from:q[:0]) map(tofrom:r[:0]) private(i) map(from:err)
93 for (i
= 0; i
< 8; i
++)
100 /* Since OpenMP 5.2, 'r' is no longer set to NULL if *r is unmapped.*/
109 /* Implicit mapping of pointers behaves the same way. */
110 #pragma omp target private(i) map(from:err)
113 for (i
= 0; i
< 8; i
++)
120 /* Since OpenMP 5.2, 'r' is no longer set to NULL if *r is unmapped.*/
129 /* And zero-length array sections, though not known at compile
130 time, behave the same. */
131 #pragma omp target map(p[:n]) map(alloc:q[:n]) map(from:r[:n]) private(i) map(from:err)
134 for (i
= 0; i
< 8; i
++)
141 /* Since OpenMP 5.2, 'r' is no longer set to NULL if *r is unmapped.*/
150 /* Non-zero length array sections, though not known at compile,
151 behave differently. */
152 #pragma omp target map(p[:m]) map(alloc:q[:m]) map(tofrom:r[:m]) private(i) map(from:err)
155 for (i
= 0; i
< 8; i
++)
158 if (q
[0] != 9 || r
[0] != 10)
171 for (i
= 0; i
< 32; i
++)
173 foo (a
+ 1, a
+ 9, a
+ 10, 0, 1);