From 55efcc54e97e28afbe25afac04c20c769994b1e5 Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 29 Mar 2023 13:09:25 +0100 Subject: [PATCH] [SYCL] Fix undefined behaviour in vector printf specifier The use of `%v` vector specifiers requires a length modifier as per OpenCL specification. --- sycl/test-e2e/DeviceLib/built-ins/printf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test-e2e/DeviceLib/built-ins/printf.cpp b/sycl/test-e2e/DeviceLib/built-ins/printf.cpp index 36aee3b8f2fb0..27d72070aa98a 100644 --- a/sycl/test-e2e/DeviceLib/built-ins/printf.cpp +++ b/sycl/test-e2e/DeviceLib/built-ins/printf.cpp @@ -64,7 +64,7 @@ int main() { // On SPIRV devices, vectors can be printed via native OpenCL types: using ocl_int4 = sycl::vec::vector_t; { - static const CONSTANT char format[] = "%v4d\n"; + static const CONSTANT char format[] = "%v4hld\n"; ext::oneapi::experimental::printf(format, (ocl_int4)v4); }