From 29230c80d117e29ba113ac8522b6fd2946ac56f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Cabrera=20P=C3=A9rez?= Date: Fri, 5 Jul 2024 09:42:18 +0100 Subject: [PATCH] [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 --- sycl/include/syclcompat/util.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sycl/include/syclcompat/util.hpp b/sycl/include/syclcompat/util.hpp index c41170f004f23..c7a53522c8e51 100644 --- a/sycl/include/syclcompat/util.hpp +++ b/sycl/include/syclcompat/util.hpp @@ -922,7 +922,8 @@ class group : public group_base { /// If x <= 2, then return a pointer to the default queue; /// otherwise, return x reinterpreted as a queue_ptr. inline queue_ptr int_as_queue_ptr(uintptr_t x) { - return x <= 2 ? &get_default_queue() : reinterpret_cast(x); + return x <= 2 ? detail::dev_mgr::instance().current_device().default_queue() + : reinterpret_cast(x); } template