1// RUN: %libomptarget-compile-generic -DVAR -c -o %t.o
2// RUN: %libomptarget-compile-generic %t.o && %libomptarget-run-generic | %fcheck-generic
3
4#ifdef VAR
5int x = 1;
6#else
7#include <stdio.h>
8#include <assert.h>
9extern int x;
10
11int main() {
12 int value = 0;
13#pragma omp target map(from : value)
14 value = x;
15 assert(value == 1);
16
17 x = 999;
18#pragma omp target update to(x)
19
20#pragma omp target map(from : value)
21 value = x;
22 assert(value == 999);
23
24 // CHECK: PASS
25 printf (format: "PASS\n");
26}
27#endif
28

source code of offload/test/offloading/extern.c