fix: explicitly specify the length of the format string and new line string.

Signed-off-by: jackfiled <xcrenchangjun@outlook.com>
This commit is contained in:
jackfiled 2025-06-08 16:22:23 +08:00
parent 14a2b4c558
commit a98e9aec78
Signed by: jackfiled
GPG Key ID: DEF448811AE0286D

View File

@ -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<mlir::Value, 4> loopIterators;