aboutsummaryrefslogtreecommitdiff
path: root/offload/test/offloading/static_linking.c
blob: 273109e10c09e7022acb3ba0d07f4730dc8b131e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// RUN: %libomptarget-compile-generic -DLIBRARY -c -o %t.o
// RUN: ar rcs %t.a %t.o
// RUN: %libomptarget-compile-generic %t.a && %libomptarget-run-generic 2>&1 | %fcheck-generic

#ifdef LIBRARY
int x = 42;
#pragma omp declare target(x)

int foo() {
  int value;
#pragma omp target map(from : value)
  value = x;
  return value;
}
#else
#include <stdio.h>
int foo(void);

int main() {
  int x = foo();

  // CHECK: PASS
  if (x == 42)
    printf("PASS\n");
}
#endif