1 // RUN: %libomptarget-compilexx-run-and-check-generic
2
3 #include <algorithm>
4
5 extern "C" int printf(const char *, ...);
6
7 // std::equal is lowered to libc function memcmp.
test_memcpy()8 void test_memcpy() {
9 int r = 0;
10 #pragma omp target map(from : r)
11 {
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;
18 }
19 printf("memcmp: %s\n", r ? "PASS" : "FAIL");
20 }
21
main(int argc,char * argv[])22 int main(int argc, char *argv[]) {
23 test_memcpy();
24
25 return 0;
26 }
27
28 // CHECK: memcmp: PASS
29