Presumable compiler bug? A segfault that's easily circumvented by minimally re-arranging stuff without changing code meaning at all: #4228
Labels
bug
Observed behavior contradicts documented or intended behavior
miscompilation
The compiler reports success but produces semantically incorrect code.
stage1
The process of building from source via WebAssembly and the C backend.
Milestone
(Using nightly zig-linux-x86_64-0.5.0+b72f85819 from 2020-01-18.)
Behold, a maximally minimal (really!)
zig run
nablemain.zig
repro case, extracted from bigger project --- but first, skip down to the upshot / short description just below this 88-line snippet:With the above, doing
zig run main.zig
:Now to circumvent this (until fixed/explained =), from what I have found one has 2 options, either one by itself alone will already do the trick:
fn enHeap
into the callsite directly / by hand.Args =
, put it between line 15 & 16 to be assigned to a new localconst tmpargs = ...
, then use that local for the.Args =
initializerBoth ways the program will work as expected, printing out the original input string from line 7. These "fixes" are mere re-arrangements / different placements without (AFAICT) any semantic differences. (So shouldn't have to dig around for such silly workarounds =)
The text was updated successfully, but these errors were encountered: