[llvm] [flang][runtime] Debug PRINT *, "HI" on GPU (PR #172087)
Peter Klausler via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 12 13:46:30 PST 2025
================
@@ -124,15 +127,11 @@ std::size_t PseudoOpenFile::Read(
std::size_t PseudoOpenFile::Write(FileOffset at, const char *buffer,
std::size_t bytes, IoErrorHandler &handler) {
- if (at) {
- handler.Crash("%s: unsupported", RT_PRETTY_FUNCTION);
- }
- // TODO: use persistent string buffer that can be reallocated
- // as needed, and only freed at destruction of *this.
- auto string{SizedNew<char>{handler}(bytes + 1)};
- runtime::memcpy(string.get(), buffer, bytes);
- string.get()[bytes] = '\0';
- std::printf("%s", string.get());
+ char *mutableBuffer{const_cast<char *>(buffer)};
+ char save{buffer[bytes]};
+ mutableBuffer[bytes] = '\0';
+ std::printf("%s", buffer);
+ mutableBuffer[bytes] = save;
----------------
klausler wrote:
There needs to be a NUL at the end of the string for `"%s"` formatting to work.
https://github.com/llvm/llvm-project/pull/172087
More information about the llvm-commits
mailing list