================
@@ -0,0 +1,101 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c23 -ffreestanding 
-fsyntax-only -verify %s
+
+#include <stdint.h>
+
+int printf(const char *restrict, ...) __attribute__((format(printf, 1, 2)));
+int scanf(const char *restrict, ...) __attribute__((format(scanf, 1, 2)));
+
+void t1(int8_t i8, uint8_t u8, int16_t i16, uint16_t u16, int32_t i32,
+        uint32_t u32, int64_t i64, uint64_t u64, int_fast8_t if8,
+        uint_fast8_t uf8, int_fast16_t if16, uint_fast16_t uf16,
+        int_fast32_t if32, uint_fast32_t uf32, int_fast64_t if64,
+        uint_fast64_t uf64) {
+  printf("%w8d", i8);
+  printf("%w8u", u8);
+  printf("%w16d", i16);
+  printf("%w16u", u16);
+  printf("%w32d", i32);
+  printf("%w32i", i32);
+  printf("%w32u", u32);
+  printf("%w32x", u32);
+  printf("%w32b", u32);
+  printf("%w64d", i64);
+  printf("%w64u", u64);
+  printf("%wf8d", if8);
+  printf("%wf8u", uf8);
+  printf("%wf16d", if16);
+  printf("%wf16u", uf16);
+  printf("%wf32d", if32);
+  printf("%wf32u", uf32);
+  printf("%wf32B", uf32);
+  printf("%wf64d", if64);
+  printf("%wf64u", uf64);
+
+  printf("%w32d", 1);
+  printf("%w32d", i32);
+  printf("%w16d", 1);
+  printf("%w16d", 65536);
+  printf("%w16d", i32);
----------------
AaronBallman wrote:

This is an interesting test case -- I was aiming for an `int` variable again, 
but in this case, we know the variable passed is 32-bits and the format 
specifier is only 16-bits. I think the behavior here is fine as-is for now, but 
we may want to enable a diagnostic for this case because of the extra type 
information.

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

Reply via email to