Mercurial > hg > CbC > CbC_gcc
comparison libgomp/testsuite/libgomp.oacc-c-c++-common/structured-dynamic-lifetimes-7.c @ 152:2b5abeee2509
update gcc11
author | anatofuz |
---|---|
date | Mon, 25 May 2020 07:50:57 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
145:1830386684a0 | 152:2b5abeee2509 |
---|---|
1 /* { dg-skip-if "" { *-*-* } { "-DACC_MEM_SHARED=1" } } */ | |
2 | |
3 #include <openacc.h> | |
4 #include <assert.h> | |
5 #include <stdlib.h> | |
6 | |
7 #define SIZE 1024 | |
8 | |
9 int | |
10 main (int argc, char *argv[]) | |
11 { | |
12 char *block1 = (char *) malloc (SIZE); | |
13 char *block2 = (char *) malloc (SIZE); | |
14 | |
15 #ifdef OPENACC_API | |
16 acc_copyin (block1, SIZE); | |
17 #else | |
18 #pragma acc enter data copyin(block1[0:SIZE]) | |
19 #endif | |
20 | |
21 #pragma acc data copy(block1[0:SIZE], block2[0:SIZE]) | |
22 { | |
23 /* We can't attach the dynamic data mapping's (block1) target_mem_desc to the | |
24 enclosing structured data region here, because that region maps block2 | |
25 also. */ | |
26 #ifdef OPENACC_API | |
27 acc_copyout (block1, SIZE); | |
28 #else | |
29 #pragma acc exit data copyout(block1[0:SIZE]) | |
30 #endif | |
31 /* These should stay present until the end of the structured data | |
32 lifetime. */ | |
33 assert (acc_is_present (block1, SIZE)); | |
34 assert (acc_is_present (block2, SIZE)); | |
35 } | |
36 | |
37 assert (!acc_is_present (block1, SIZE)); | |
38 assert (!acc_is_present (block2, SIZE)); | |
39 | |
40 free (block1); | |
41 free (block2); | |
42 | |
43 return 0; | |
44 } |