2 // { dg-additional-options "-fdump-tree-gimple" }
5 extern "C" void abort ();
18 #pragma omp target map(from:mapped)
21 for (int i = 0; i < ptr_len; i++)
23 mapped = (ptr != NULL);
28 bool set_refptr (int n)
31 #pragma omp target map(from:mapped)
34 for (int i = 0; i < refptr_len; i++)
36 mapped = (refptr != NULL);
45 int *ptr1 = new int[N];
46 int *ptr2 = new int[N];
48 memset (ptr1, 0, sizeof (int) * N);
49 memset (ptr2, 0, sizeof (int) * N);
51 S s = { ptr1, N, ptr2, N };
56 mapped = s.set_ptr (val);
61 for (int i = 0; i < N; i++)
65 mapped = s.set_refptr (val);
70 for (int i = 0; i < N; i++)
74 #pragma omp target data map(ptr1[:N])
75 mapped = s.set_ptr (val);
81 if (s.ptr != ptr1 || s.refptr != ptr2)
83 for (int i = 0; i < N; i++)
87 #pragma omp target data map(ptr2[:N])
88 mapped = s.set_refptr (val);
94 if (s.ptr != ptr1 || s.refptr != ptr2)
96 for (int i = 0; i < N; i++)
103 /* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(n\) map\(tofrom:\*this \[len: [0-9]+\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9+] \[len: 0\]\) map\(alloc:\*_[0-9]+ \[pointer assign, zero-length array section, bias: 0\]\) map\(attach:this->refptr \[bias: 0\]\)} "gimple" } } */
105 /* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(n\) map\(tofrom:\*this \[len: [0-9]+\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(attach_zero_length_array_section:this->ptr \[bias: 0\]\)} "gimple" } } */