[Instrumentation] Fix a warning
[llvm-project.git] / offload / test / offloading / test_libc.cpp
blob859c2da97de0bc351995a9c9a3f7e88ab74690ce
1 // RUN: %libomptarget-compilexx-run-and-check-generic
3 #include <algorithm>
5 extern "C" int printf(const char *, ...);
7 // std::equal is lowered to libc function memcmp.
8 void test_memcpy() {
9 int r = 0;
10 #pragma omp target map(from : r)
12 int x[2] = {0, 0};
13 int y[2] = {0, 0};
14 int z[2] = {0, 1};
15 bool eq1 = std::equal(x, x + 2, y);
16 bool eq2 = std::equal(x, x + 2, z);
17 r = eq1 && !eq2;
19 printf("memcmp: %s\n", r ? "PASS" : "FAIL");
22 int main(int argc, char *argv[]) {
23 test_memcpy();
25 return 0;
28 // CHECK: memcmp: PASS