Skip to content

Commit 29230c8

Browse files
authored
[SYCL][COMPAT] Fix using address of a temporary queue_ptr in util.hpp (#14440)
Fixes the path for `x <= 2` in `int_as_queue_ptr`, which was returning an address to a temporary pointer. Signed-off-by: Alberto Cabrera <[email protected]>
1 parent 4cb0518 commit 29230c8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sycl/include/syclcompat/util.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,8 @@ class group : public group_base<dimensions> {
922922
/// If x <= 2, then return a pointer to the default queue;
923923
/// otherwise, return x reinterpreted as a queue_ptr.
924924
inline queue_ptr int_as_queue_ptr(uintptr_t x) {
925-
return x <= 2 ? &get_default_queue() : reinterpret_cast<queue_ptr>(x);
925+
return x <= 2 ? detail::dev_mgr::instance().current_device().default_queue()
926+
: reinterpret_cast<queue_ptr>(x);
926927
}
927928

928929
template <int n_nondefault_params, int n_default_params, typename T>

0 commit comments

Comments
 (0)