From a98e9aec786f3b987567eec7a36dd2e73da44b53 Mon Sep 17 00:00:00 2001 From: jackfiled Date: Sun, 8 Jun 2025 16:22:23 +0800 Subject: [PATCH] fix: explicitly specify the length of the format string and new line string. Signed-off-by: jackfiled --- lib/LowerToLLVMPass.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/LowerToLLVMPass.cpp b/lib/LowerToLLVMPass.cpp index 00f769f..764d4ca 100644 --- a/lib/LowerToLLVMPass.cpp +++ b/lib/LowerToLLVMPass.cpp @@ -47,10 +47,11 @@ namespace // Create the format string in C format. mlir::Value formatSpecifierString = getOrCreateGlobalString(location, rewriter, "format_specifier", - "%f \0", + llvm::StringRef("%f \0", 4), parentModule); // Create the LF format string in C format. - mlir::Value newLineString = getOrCreateGlobalString(location, rewriter, "new_line", "\n\0", parentModule); + mlir::Value newLineString = getOrCreateGlobalString(location, rewriter, "new_line", + llvm::StringRef("\n\0", 2), parentModule); // Create a loop to print the value in the tensor. llvm::SmallVector loopIterators;