[llvm] [llvm-strings] Use small buffer instead of reading whole file (PR #163073)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 00:07:58 PDT 2026


================
@@ -51,57 +43,28 @@
 ## before the chunk start and one after its end. The string is printed
 ## intact, once. The expected output is generated rather than written as a
 ## CHECK line because it is a chunk long.
-# RUN: %python %s 16383 S M at 16384 E 4 > %t.6
-# RUN: %python %s --line S M at 16384 E > %t.6.expected
+# RUN: printf "%16383sS%.16384dE%4s" | tr " " "\0" > %t.6
+# RUN: printf "S%.16384dE\n" > %t.6.expected
----------------
jh7370 wrote:

So it turns out that despite me thinking I'd removed the GnuWin32 tools from my PATH, I hadn't. I've fixed that now and the test passes. I guess there must have been a serious bug in its version of printf, for it to mess up the size of the data so dramatically...! (It was installed because when I last set up this machine, it was the process I'd followed the previous time to get LLVM working, I hadn't registered that the recommendations had changed evidently).

I think we could reasonably safely say that we shouldn't be supporting GnuWin32 tools, per the statement you highlighted. However, I think a comment next to the first instance of printf that prints a new line would not go amiss saying something like "Some older versions of printf on Windows produced \r\n instead of \n, which would cause the subsequent diff to fail. Make sure you are using an up-to-date version." Then if a developer reports they have updated and they're still seeing problems, we can address the issue at that point.

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


More information about the llvm-commits mailing list