diff --git a/openmp/libomptarget/src/api.cpp b/openmp/libomptarget/src/api.cpp --- a/openmp/libomptarget/src/api.cpp +++ b/openmp/libomptarget/src/api.cpp @@ -136,7 +136,12 @@ "src offset %zu, length %zu\n", dst_device, src_device, DPxPTR(dst), DPxPTR(src), dst_offset, src_offset, length); - if (!dst || !src || length <= 0) { + if (length == 0) { + DP("Call to omp_target_memcpy with zero length, nothing to do\n"); + return OFFLOAD_SUCCESS; + } + + if (!dst || !src || length < 0) { REPORT("Call to omp_target_memcpy with invalid arguments\n"); return OFFLOAD_FAIL; }