================
@@ -0,0 +1,30 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -triple amdgpu-amd-amdhsa -emit-llvm -fcuda-is-device \
+// RUN:   -Wno-format -mprintf-kind=hostcall -o - %s \
+// RUN:   | FileCheck --check-prefix=HOSTCALL %s
+// RUN: %clang_cc1 -triple amdgpu-amd-amdhsa -emit-llvm -fcuda-is-device \
+// RUN:   -Wno-format -mprintf-kind=buffered -o - %s \
+// RUN:   | FileCheck --check-prefix=BUFFERED %s
+
+// A format string ending in an incomplete specifier must not be read past its
+// end, and the specifiers before it must still be found.
+
+#define __device__ __attribute__((device))
+
+extern "C" __device__ int printf(const char *format, ...);
+
+__device__ int trailing_percent(const char *s) { return printf("%s%", s); }
+
----------------
steffenlarsen wrote:

Sure! clang/test/CodeGenHIP/printf-builtin.hip now has the test case. As per 
separate request, I used llvm/utils/update_cc_test_checks.py to generate the 
checks for the test, which also changed the checks for the existing case. 
Hopefully that isn't too intrusive for this PR. Otherwise I can split it out.

https://github.com/llvm/llvm-project/pull/229088
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to