diff options
author | Shilei Tian <i@tianshilei.me> | 2022-08-04 14:48:07 -0400 |
---|---|---|
committer | Shilei Tian <i@tianshilei.me> | 2022-08-04 14:48:48 -0400 |
commit | 459e3c51840a7f09536a7839deb7184b53bd7e92 (patch) | |
tree | 4716428e24168b99bc9e72918d9067b312a20ce7 | |
parent | 0e051c02d51da2898240b52289c0d1e80d631132 (diff) |
[OpenMP] Fix the test case issue that printf cannot be used in target region for AMDGPU
-rw-r--r-- | openmp/libomptarget/test/offloading/test_libc.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/openmp/libomptarget/test/offloading/test_libc.cpp b/openmp/libomptarget/test/offloading/test_libc.cpp index cfccf47d7cf2..66d73d7b3e2b 100644 --- a/openmp/libomptarget/test/offloading/test_libc.cpp +++ b/openmp/libomptarget/test/offloading/test_libc.cpp @@ -6,16 +6,17 @@ extern "C" int printf(const char *, ...); // std::equal is lowered to libc function memcmp. void test_memcpy() { -#pragma omp target + int r = 0; +#pragma omp target map(from: r) { int x[2] = {0, 0}; int y[2] = {0, 0}; int z[2] = {0, 1}; bool eq1 = std::equal(x, x + 2, y); bool eq2 = std::equal(x, x + 2, z); - bool r = eq1 && !eq2; - printf("memcmp: %s\n", r ? "PASS" : "FAIL"); + r = eq1 && !eq2; } + printf("memcmp: %s\n", r ? "PASS" : "FAIL"); } int main(int argc, char *argv[]) { |