[llvm] [llubi] Implements common library functions (PR #190147)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 10:58:19 PDT 2026


================
@@ -0,0 +1,18 @@
+; NOTE: Assertions have been autogenerated by utils/update_llubi_test_checks.py UTC_ARGS: --version 6
+; RUN: not llubi --verbose < %s 2>&1 | FileCheck %s
+
+declare i32 @printf(ptr, ...)
+
+define i32 @main() {
+  %fmt = alloca [18 x i8]
+  store [18 x i8] c"Ints: %d, %i, %u\0A\00", ptr %fmt
+
+  call i32 (ptr, ...) @printf(ptr %fmt, i32 42, i32 -42, i32 255, i32 255)
+
+  ret i32 0
+}
+; CHECK: Entering function: main
+; CHECK-NEXT:   %fmt = alloca [18 x i8], align 1 => ptr 0x8 [fmt]
+; CHECK-NEXT:   store [18 x i8] c"Ints: %d, %i, %u\0A\00", ptr %fmt, align 1
+; CHECK-NEXT: Immediate UB detected: Too many arguments provided for the format string.
----------------
dtcxzyw wrote:

> If there are more arguments than required by format, the extraneous arguments are evaluated and ignored.

https://github.com/llvm/llvm-project/pull/190147


More information about the llvm-commits mailing list