[clang] [clang][SYCL] Handle cdecl variadic functions for SYCL device (PR #194922)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 30 00:48:50 PDT 2026
================
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -isystem %S/Inputs/ -fsycl-is-device -triple spirv64 -aux-triple x86_64-pc-windows-msvc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -isystem %S/Inputs/ -fsycl-is-device -triple spirv64 -fsyntax-only -verify %s
+
+// Check that there is no error/warning emitted for cdecl functions compiled for
+// SYCL device. Make sure variadic calls from within device code are diagnosed.
+
+__inline __cdecl int printf(char const* const _Format, ...) { return 0; }
+
+// FIXME: that should be diagnosed.
----------------
Fznamznon wrote:
> So, I guess such declarations are fine so long as the function is never called from a device
I think this is an overlook from the spec side. AFAIK SYCL_EXTERNAL forces emission of the function on the device side even if it is never called. What is the point of doing that if it can't be called anyway. It may also upset SPIR-V generation.
https://github.com/llvm/llvm-project/pull/194922
More information about the cfe-commits
mailing list