xfail scan-tree-dump-not throw in g++.dg/pr99966.C on hppa*64*-*-*
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / target-present-1.c
blob5eaa9cd1ad31865c8460bdeb62dcc8780215cd09
1 #include <stdio.h>
3 #define N 100
5 int main (void)
7 int a[N], b[N], c[N], d[N];
9 for (int i = 0; i < N; i++) {
10 a[i] = i * 2;
11 b[i] = i * 3 + 1;
12 d[i] = i * 5;
15 #pragma omp target enter data map (alloc: c, d) map(to: a)
16 #pragma omp target map (present, always, to: d)
17 for (int i = 0; i < N; i++)
18 if (d[i] != i * 5)
19 __builtin_abort ();
21 /* a has already been mapped and 'c' allocated so this should be okay. */
22 #pragma omp target map (present, to: a) map(present, always, from: c)
23 for (int i = 0; i < N; i++)
24 c[i] = a[i];
26 for (int i = 0; i < N; i++)
27 if (c[i] != i * 2)
28 __builtin_abort ();
30 fprintf (stderr, "CheCKpOInT\n");
31 /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
33 /* b has not been allocated, so this should result in an error. */
34 /* { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" { target offload_device_nonshared_as } } */
35 /* { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } */
36 #pragma omp target map (present, to: b)
37 for (int i = 0; i < N; i++)
38 c[i] += b[i];
39 #pragma omp target exit data map (from: c)