1// RUN: %libomptarget-compilexx-run-and-check-generic
2
3#include <algorithm>
4
5extern "C" int printf(const char *, ...);
6
7// std::equal is lowered to libc function memcmp.
8void 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(first1: x, last1: x + 2, first2: y);
16 bool eq2 = std::equal(first1: x, last1: x + 2, first2: z);
17 r = eq1 && !eq2;
18 }
19 printf("memcmp: %s\n", r ? "PASS" : "FAIL");
20}
21
22int main(int argc, char *argv[]) {
23 test_memcpy();
24
25 return 0;
26}
27
28// CHECK: memcmp: PASS
29

source code of offload/test/offloading/test_libc.cpp