Open GianlucaFuwa opened 2 months ago
At first glance it seems to look like it's printing uninitialized memory somehow, which is certainly not what we want. I'm not sure why, and may not have time to investigate for a while. One possibility is https://github.com/brenhinkeller/StaticTools.jl/issues/33, which will be time consuming to fix unless @ccall
s finally fully work with standalone StaticCompiler now (I had to avoid them initially to get things to compile). Alternatively, it may be another bug, or maybe even something WSL- or OS-specific (I don't know enough about WSL to be sure on that latter point though).
This package is still very experimental so I probably wouldn't recommend it in general unless you need to statically compile for now, but if we fix #33 (esp. if that also fixes this) then it could be possible to use more widely at some point in the future.
Another thing to note, in case you or someone else find time to investigate this bug at some point, is that I have only seen this behavior so far when printing Floats but not with Ints or Strings
Ah thanks, that’s very helpful for narrowing it down!
I was trying to cut down on allocations arising from printing formatted strings to file in an application that is not statically compiled and found that the results are very inconsistent depending on multiple factors. An MWE that I have is this:
If I run this file as above, I get the following output in "mwe.txt":
Notice, that column 2 and 4 print either zeros or random junk.
If I now uncomment the header part before the loop I get:
which is reasonable.
More weird stuff happens when I, e.g, set
v
to some fixed value instead of randomly generating it: Without header:With header:
Similar things happen if I change how
τ
is defined. Alas, when using it in my package even with a header, I get faulty values (mainly zeros). Settingwith_extras
tofalse
also doesn't ameliorate this behaviour.The system I am running this on uses Ubuntu under Windows10-WSL2 on the latest version of StaticTools and Julia 1.9.4 (reason for this specific Julia version is that my package is bound to it), but I checked the MWE on 1.10.4 and got similar results. Full specs: