diff --git a/sycl/test-e2e/AddressSanitizer/out-of-bounds/local/group_local_memory.cpp b/sycl/test-e2e/AddressSanitizer/out-of-bounds/local/group_local_memory.cpp index 7355d1f98bd70..992c69d5a240f 100644 --- a/sycl/test-e2e/AddressSanitizer/out-of-bounds/local/group_local_memory.cpp +++ b/sycl/test-e2e/AddressSanitizer/out-of-bounds/local/group_local_memory.cpp @@ -16,6 +16,8 @@ constexpr std::size_t group_size = 8; int main() { sycl::queue Q; + auto *array = sycl::malloc_device(N, Q); + Q.submit([&](sycl::handler &h) { h.parallel_for( sycl::nd_range<1>(N, group_size), [=](sycl::nd_item<1> item) { @@ -23,7 +25,9 @@ int main() { ptr = sycl::ext::oneapi::group_local_memory( item.get_group()); auto &ref = *ptr; - ref[item.get_local_linear_id() * 2 + 4] = 42; + size_t lid = item.get_local_linear_id(); + ref[lid * 2 + 4] = 42; + array[item.get_global_linear_id()] = ref[lid]; // CHECK: ERROR: DeviceSanitizer: out-of-bounds-access on Local Memory // CHECK: WRITE of size 4 at kernel {{<.*MyKernel>}} LID(6, 0, 0) GID({{.*}}, 0, 0) // CHECK: #0 {{.*}} {{.*group_local_memory.cpp}}:[[@LINE-3]] @@ -31,5 +35,6 @@ int main() { }); Q.wait(); + sycl::free(array, Q); return 0; }