Skip to content

Commit 2c88555

Browse files
committed
fix bad_free
1 parent 4202d86 commit 2c88555

File tree

1 file changed

+12
-3
lines changed
  • DirectProgramming/C++SYCL/DenseLinearAlgebra/address_sanitizer/src

1 file changed

+12
-3
lines changed
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
// REQUIRES: linux
2-
// RUN: %{build} %device_sanitizer_flags -O0 -g -o %t
3-
// RUN: env SYCL_PREFER_UR=1 UR_ENABLE_LAYERS=UR_LAYER_ASAN %{run} not %t 2>&1 | FileCheck --check-prefixes CHECK %s
1+
// Copyright (C) 2024 Intel Corporation
2+
// SPDX-License-Identifier: MIT
3+
44
#include <sycl/sycl.hpp>
55

66
constexpr size_t N = 64;
77

88
int main() {
99
sycl::queue Q;
1010
auto *data = new int[N];
11+
auto *array = sycl::malloc_device<long long>(N, Q);
12+
13+
Q.submit([&](sycl::handler &h) {
14+
h.parallel_for<class MyKernel>(
15+
sycl::nd_range<1>(N, 1),
16+
[=](sycl::nd_item<1> item) { ++array[item.get_global_id(0)]; });
17+
});
18+
Q.wait();
19+
1120
sycl::free(data, Q);
1221
return 0;
1322
}

0 commit comments

Comments
 (0)