zig icon indicating copy to clipboard operation
zig copied to clipboard

Compiler segfault when using `-fno-emit-bin` and `-fno-LLVM` at the same time

Open windows-h8r opened this issue 4 years ago • 5 comments

Zig Version

0.10.0-dev.263+c5ee73f65

Steps to Reproduce

$ zig build-exe -fno-emit-bin -fno-LLVM nonexistent_file.zig

Expected Behavior

error: unable to load 'nonexistent_file.zig': FileNotFound

Actual Behavior

fish: “zig build-exe -fno-emit-bin -fn…” terminated by signal SIGSEGV (Address boundary error)

windows-h8r avatar Jan 17 '22 03:01 windows-h8r

I tested the example on Linux, with Zig stage1 version 0.10.0-dev.2306+50a5ddecc and with Zig stage2 version 0.10.0-dev.2117+e8c85450f and it works correctly.

@windows-h8r, can you check if it also works for you, with a recent version of Zig? Was the example executed on Windows?

perillo avatar May 27 '22 13:05 perillo

@perillo No, it was executed on Linux. Now, it works on my computer with the latest version of Zig.

windows-h8r avatar Jun 12 '22 02:06 windows-h8r

@windows-h8r Thanks. @Vexu Ping.

perillo avatar Jun 12 '22 13:06 perillo

Still crashes for me using a debug build of stage2.

Vexu avatar Jun 12 '22 13:06 Vexu

I missed the "nonexistent" part which does seem to be fixed, but using an existing file will still panic with "attempt to use null value".

Vexu avatar Jun 12 '22 13:06 Vexu

I missed the "nonexistent" part which does seem to be fixed, but using an existing file will still panic with "attempt to use null value".

Can no longer reproduce this on 0.12.0-dev.601+f4c884617:

# debug build, 0.12.0-dev.601+f4c884617
$ zig build-exe -fno-emit-bin -fno-llvm main.zig  # no panic
$ zig build-exe -fno-emit-bin -fno-llvm -fno-libllvm main.zig # no panic

--verbose-air etc. works so it indeed analyze this and not just discards everything.

BratishkaErik avatar Sep 26 '23 16:09 BratishkaErik