Skip to content

Possible memory corruption in the compiler #25339

@mhanberg

Description

@mhanberg

Zig Version

0.16.0-dev.234+32a1aabff

Steps to Reproduce and Observed Behavior

Description

This issue is rather involved, apologies. I'll do my best to describe the issue without getting too bogged down in orthogonal details.

I write Elixir, and use a library called burrito to create a single executable for distributing the software.

Burrito works essentially by creating a "wrapper" Zig application which is then packs an archive of the Erlang OTP runtime and your Elixir project into it. It also uses Zig to cross compile any FFI (known as NIFs in Elixir/Erlang parlance) code you might have (C code).

Starting sometime in 0.14.x, on certain x86_64 CPUs (running some kind of Linux, usually) and on certain projects, I found I was no longer able to create the burrito release ("release" is a specific Elixir/Erlang term, but its not too important here).

If I attempt to create the release (which, compiles the Zig exe), I get this output (this is using Zig 0.15.1, I get the same result when running a ReleaseSmall build)

install
└─ install expert
   └─ compile exe expert Debug x86_64-linux failure
error: the following command terminated unexpectedly:
/nix/store/d7vvymxcqk4v5891n1vfyx40crsw3iz9-zig-0.15.1/bin/zig build-exe /home/mitchell/src/burrito/src/xz/xz_crc32.c /home/mitchell/src/burrito/src/xz/xz_dec_lzma2.c /home/mitchell/src/burrito/src/xz/xz_dec_stream.c -ODebug -target x86_64-linux -mcpu baseline -I /home/mitchell/src/burrito/src/xz --dep build_options --dep burrito_plugin -Mroot=/home/mitchell/src/burrito/src/wrapper.zig -Mbuild_options=.zig-cache/c/93bcb6b1910c35fe48278743974d3635/options.zig -Mburrito_plugin=/home/mitchell/src/burrito/_dummy_plugin.zig -lc --cache-dir .zig-cache --global-cache-dir /home/mitchell/.cache/zig --name expert --zig-lib-dir /nix/store/d7vvymxcqk4v5891n1vfyx40crsw3iz9-zig-0.15.1/lib/ --listen=-

Build Summary: 1/4 steps succeeded; 1 failed
install transitive failure
└─ install expert transitive failure
   └─ compile exe expert Debug x86_64-linux failure

error: the following build command failed with exit code 1:
.zig-cache/o/da53d09588a6fae070aa0c1e186d8ea8/build /nix/store/d7vvymxcqk4v5891n1vfyx40crsw3iz9-zig-0.15.1/bin/zig /nix/store/d7vvymxcqk4v5891n1vfyx40crsw3iz9-zig-0.15.1/lib /home/mitchell/src/burrito .zig-cache /home/mitchell/.cache/zig --seed 0x4a3aaaca -Z04fe781917b8d2fa -Dtarget=x86_64-linux -Dcpu=baseline

On Zig 0.14.0, running a Debug build yields a nosier result

install
mq install expert
   mq zig build-exe expert Debug x86_64-linux 49 errors
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/debug.zig:1367:27: error: struct ' has no member named ''
        .flags = (posix.SA.SIGINFO | posix.SA.RESTART | posix.SA.RESETHAND),
                  ~~~~~~~~^~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/os/linux.zig:3372:8: note: struct declared here
} else struct {
       ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:1819:11: note: called from here
    format(counting_writer.writer().any(), fmt, args) catch unreachable;
    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:1863:83: note: called from here
pub inline fn comptimePrint(comptime fmt: []const u8, args: anytype) *const [count(fmt, args):0]u8 {
                                                                             ~~~~~^~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:212:48: note: called from here
            else => @compileError(comptimePrint("{d}", .{missing_count}) ++ " unused arguments in '" ++ fmt ++ "'"),
                                  ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fmt.zig:211:18: error:
            1 => @compileError("unused argument in '" ++ fmt ++ "'"),
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fs/Dir.zig:1158:23: error: no field or member function named '' in ''
    var component = it.last() orelse return;
                    ~~^~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fs/path.zig:1391:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fs/Dir.zig:1654:9: error: expected type 'error{InvalidUtf8,AccessDenied,SystemResources,Unexpected,FileNotFound,NameTooLong,InvalidWtf8,BadPathName,NetworkNotFound,SymLinkLoop,IsDir,NotDir,FileBusy,FileSystem,ReadOnlyFileSystem,}', found 'error{}'
        error.DirNotEmpty => unreachable, // not passing AT.REMOVEDIR
        ^~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fs/Dir.zig:1654:9: note: 'error.' not a member of destination error set
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fs/Dir.zig:2051:10: error: no field named '' in struct ''
        .parent_dir = self,
         ^~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fs/Dir.zig:2035:23: note: struct declared here
    const StackItem = struct {
                      ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fs/path.zig:1489:18: error: no field named '' in struct ''
                .root_end_index = root_end_index,
                 ^~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fs/path.zig:1391:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/heap/PageAllocator.zig:183:78: error: no field named '' in struct 'os.linux.MREMAP'
        const new_memory = posix.mremap(memory.ptr, memory.len, new_len, .{ .MAYMOVE = may_move }, null) catch return null;
                                                                             ^~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/os/linux.zig:308:27: note: struct declared here
pub const MREMAP = packed struct(u32) {
                   ~~~~~~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:28:25: error: no field or member function named '' in ''
                try self.flush();
                    ~~~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:28:25: note: method invocation only supports up to one level of implicit pointer dereferencing
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:28:25: note: use '.*' to dereference pointer
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:42:16: error: no field named '' in struct ''
    return .{ .unbuffered_writer = underlying_stream };
               ^~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/log.zig:159:11: error: no field or member function named '' in ''
        bw.flush() catch return;
        ~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/log.zig:159:11: error: no field or member function named '' in ''
        bw.flush() catch return;
        ~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/log.zig:159:11: error: no field or member function named ' in ''
        bw.flush() catch return;
        ~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/log.zig:159:11: error: no field or member function named '' in ''
        bw.flush() catch return;
        ~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/log.zig:159:11: error: no field or member function named '' in ''
        bw.flush() catch return;
        ~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/log.zig:159:11: error: no field or member function named '' in ''
        bw.flush() catch return;
        ~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/log.zig:159:11: error: no field or member function named '' in ''
        bw.flush() catch return;
        ~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/log.zig:159:11: error: no field or member function named '' in ''
        bw.flush() catch return;
        ~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/io/buffered_writer.zig:7:12: note: struct declared here
    return struct {
           ^~~~~~
src/metadata.zig:13:37: error: root source file struct 'json' has no member named ''
    const metadata_parsed = std.json.parseFromSlice(MetaStruct, allocator, string_data, .{}) catch |e| {
                            ~~~~~~~~^~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/json.zig:1:1: note: struct declared here
//! JSON parsing and stringification conforming to RFC 8259. https://datatracker.ietf.org/doc/html/rfc8259
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/os/windows.zig:4562:27: error: no field named '' in struct 'os.windows.TEB'
    assert(@offsetOf(TEB, "NtTib") == 0x00);
                          ^~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/os/windows.zig:4541:24: note: struct declared here
pub const TEB = extern struct {
                ~~~~~~~^~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/posix.zig:2544:32: error: expected type 'error{InvalidUtf8,AccessDenied,SystemResources,Unexpected,FileNotFound,NameTooLong,InvalidWtf8,BadPathName,NetworkNotFound,SymLinkLoop,IsDir,NotDir,FileBusy,FileSystem,ReadOnlyFileSystem,}', found type 'error{}'
        .EXIST => return error.DirNotEmpty,
                               ^~~~~~~~~~~
src/wrapper.zig:91:11: error: root source file struct '' has no member named ''
    plugin.burrito_plugin_entry(install_dir, RELEASE_METADATA_JSON);
    ~~~~~~^~~~~~~~~~~~~~~~~~~~~
_dummy_plugin.zig:1:1: note: struct declared here
pub fn burrito_plugin_entry(install_dir: []const u8, program_manifest_json: []const u8) void {
^~~
src/wrapper.zig:220:61: error: struct 'fs.File.PermissionsUnix' has no member named ''
        const exec_permissions = std.fs.File.PermissionsUnix.unixNew(0o754);
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/std/fs/File.zig:629:29: note: struct declared here
pub const PermissionsUnix = struct {
                            ^~~~~~
error: the following command failed with 49 compilation errors:
/nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/bin/zig build-exe /home/mitchell/src/burrito/src/xz/xz_crc32.c /home/mitchell/src/burrito/src/xz/xz_dec_lzma2.c /home/mitchell/src/burrito/src/xz/xz_dec_stream.c -ODebug -target x86_64-linux -mcpu baseline -I /home/mitchell/src/burrito/src/xz --dep build_options --dep burrito_plugin -Mroot=/home/mitchell/src/burrito/src/wrapper.zig -Mbuild_options=/home/mitchell/src/burrito/.zig-cache/c/0c77cf930c9aa07ec71651024bb76710/options.zig -Mburrito_plugin=/home/mitchell/src/burrito/_dummy_plugin.zig -lc --cache-dir /home/mitchell/src/burrito/.zig-cache --global-cache-dir /home/mitchell/.cache/zig --name expert --zig-lib-dir /nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib/ --listen=-
Build Summary: 1/4 steps succeeded; 1 failed
install transitive failure
mq install expert transitive failure
   mq zig build-exe expert Debug x86_64-linux 49 errors
error: the following build command failed with exit code 1:
/home/mitchell/src/burrito/.zig-cache/o/3ca49c90893ec56c6ebce4741f8e5a85/build /nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/bin/zig /nix/store/nrai0wmbaympfdjbb3xhh57c19fc79y9-zig-0.14.0/lib /home/mitchell/src/burrito /home/mitchell/src/burrito/.zig-cache /home/mitchell/.cache/zig --seed 0x2bfbe7b1 -Z41a3f2e9fe3ce21d -Dtarget=x86_64-linux

After seeking help on the Zig discord, I had a few people scratching their heads and suggesting I build a debug build of the compiler itself and run that and see what it puts out.

After doing so (zig version emits 0.16.0-dev.234+32a1aabff), I get the following output when attempting to build the release

install
mq install expert
   mq compile exe expert ReleaseSmall x86_64-linux failure
error: thread 1352582 panic: reached unreachable code
Analyzing Analyzing 'src/wrapper.zig'
      %264 = validate_array_init_result_ty(%261, 1) node_offset:70:50 to :70:70
      %265 = array_init_elem_type(%261, 0)
      %266 = decl_val("FOILZ_PAYLOAD") token_offset:70:52 to :70:65
      %267 = dbg_stmt(29, 65)
    > %268 = field_val(%266, "len") node_offset:70:52 to :70:69
      %269 = array_init(%261{%268}) node_offset:70:50 to :70:70
      %270 = break_inline(%261, %269)
    For full context, use the command
      zig ast-check -t src/wrapper.zig

  in src/wrapper.zig
    > %261 = field_call(nodiscard .auto, %259, "debug", [
        {%262, %263},
        {%264..%270},
      ]) node_offset:70:5 to :70:71
  in /home/mitchell/src/zig/lib/std/start.zig
    > %2052 = is_non_err(%2051)
  in /home/mitchell/src/zig/lib/std/start.zig
    > %2054 = block({%2049..%2053})
  in /home/mitchell/src/zig/lib/std/start.zig
    > %2016 = switch_block(%2011,
        else => {%2034..%2153},
        @void_type => {%2017..%2025},
        @noreturn_type, @u8_type => {%2026..%2033})
  in /home/mitchell/src/zig/lib/std/start.zig
    > %1813 = call(.auto, %1811, [])
  in /home/mitchell/src/zig/lib/std/start.zig
    > %1937 = call(.auto, %1935, [
        {%1938..%1941},
        {%1942..%1947},
        {%1948},
      ])

/home/mitchell/src/zig/lib/std/debug.zig:559:14: 0x199a9c9 in assert (std.zig)
    if (!ok) unreachable; // assertion failure
             ^
/home/mitchell/src/zig/src/InternPool.zig:1782:19: 0x223d213 in wrap (main.zig)
            assert(unwrapped.index <= ip.getIndexMask(u32));
                  ^
/home/mitchell/src/zig/src/InternPool.zig:11809:88: 0x1ff7d34 in getOrPutTrailingString__anon_187673 (main.zig)
        @enumFromInt(@intFromEnum((String.Unwrapped{ .tid = tid, .index = start }).wrap(ip)));
                                                                                       ^
/home/mitchell/src/zig/src/InternPool.zig:11761:37: 0x1e26357 in getOrPutString__anon_165204 (main.zig)
    return ip.getOrPutTrailingString(gpa, tid, @intCast(slice.len + 1), embedded_nulls);
                                    ^
/home/mitchell/src/zig/src/Sema.zig:9717:58: 0x46a7de9 in zirFieldVal (main.zig)
    const field_name = try zcu.intern_pool.getOrPutString(
                                                         ^
/home/mitchell/src/zig/src/Sema.zig:1214:66: 0x3b820a8 in analyzeBodyInner (main.zig)
            .field_val                    => try sema.zirFieldVal(block, inst),
                                                                 ^
/home/mitchell/src/zig/src/Sema.zig:1062:30: 0x3bc6abd in analyzeInlineBody (main.zig)
    if (sema.analyzeBodyInner(block, body)) |_| {
                             ^
/home/mitchell/src/zig/src/Sema.zig:1095:39: 0x3012fe2 in resolveInlineBody (main.zig)
    return (try sema.analyzeInlineBody(block, body, break_target)) orelse .unreachable_value;
                                      ^
/home/mitchell/src/zig/src/Sema.zig:7124:65: 0x5a488f1 in analyzeArg (main.zig)
                const uncoerced_arg = try sema.resolveInlineBody(block, arg_body, zir_call.call_inst);
                                                                ^
/home/mitchell/src/zig/src/Sema.zig:7361:41: 0x4f26ebe in analyzeCall (main.zig)
        arg.* = try args_info.analyzeArg(sema, block, arg_idx, param_ty, func_ty_info, callee, maybe_func_inst);
                                        ^
/home/mitchell/src/zig/src/Sema.zig:6825:43: 0x4696a64 in zirCall__anon_675118 (main.zig)
    const call_inst = try sema.analyzeCall(block, func, func_ty, callee_src, call_src, modifier, ensure_result_used, args_info, call_dbg_node, .call);
                                          ^
/home/mitchell/src/zig/src/Sema.zig:1183:62: 0x3b80398 in analyzeBodyInner (main.zig)
            .field_call                   => try sema.zirCall(block, inst, .field),
                                                             ^
/home/mitchell/src/zig/src/Sema.zig:1044:26: 0x30098f1 in analyzeFnBody (main.zig)
    sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                         ^
/home/mitchell/src/zig/src/Zcu/PerThread.zig:2934:23: 0x300e7bb in analyzeFnBodyInner (main.zig)
    sema.analyzeFnBody(&inner_block, fn_info.body) catch |err| switch (err) {
                      ^
/home/mitchell/src/zig/src/Zcu/PerThread.zig:1710:40: 0x2936044 in analyzeFuncBody (main.zig)
    var air = try pt.analyzeFnBodyInner(func_index);
                                       ^
/home/mitchell/src/zig/src/Zcu/PerThread.zig:1630:66: 0x230dce8 in ensureFuncBodyUpToDate (main.zig)
    const ies_outdated, const new_failed = if (pt.analyzeFuncBody(func_index)) |result|
                                                                 ^
/home/mitchell/src/zig/src/Sema.zig:34967:38: 0x4825be3 in resolveInferredErrorSet (main.zig)
        try pt.ensureFuncBodyUpToDate(func_index);
                                     ^
/home/mitchell/src/zig/src/Sema.zig:31640:69: 0x47f20da in analyzeIsNonErrComptimeOnly (main.zig)
                const resolved_ty = try sema.resolveInferredErrorSet(block, src, set_ty);
                                                                    ^
/home/mitchell/src/zig/src/Sema.zig:31662:56: 0x4f6560e in analyzeIsNonErr (main.zig)
    const result = try sema.analyzeIsNonErrComptimeOnly(block, src, operand);
                                                       ^
/home/mitchell/src/zig/src/Sema.zig:18290:32: 0x46b08ee in zirIsNonErr (main.zig)
    return sema.analyzeIsNonErr(block, src, operand);
                               ^
/home/mitchell/src/zig/src/Sema.zig:1226:66: 0x3b82bb4 in analyzeBodyInner (main.zig)
            .is_non_err                   => try sema.zirIsNonErr(block, inst),
                                                                 ^
/home/mitchell/src/zig/src/Sema.zig:5907:34: 0x4fa53c6 in resolveBlockBody (main.zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/mitchell/src/zig/src/Sema.zig:5884:33: 0x47e13f3 in zirBlock (main.zig)
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^
/home/mitchell/src/zig/src/Sema.zig:1722:37: 0x3b91a16 in analyzeBodyInner (main.zig)
            } else try sema.zirBlock(block, inst),
                                    ^
/home/mitchell/src/zig/src/Sema.zig:5907:34: 0x4fa53c6 in resolveBlockBody (main.zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {
                                 ^
/home/mitchell/src/zig/src/Sema.zig:10383:45: 0x4f8fa91 in resolveProngComptime (main.zig)
                return sema.resolveBlockBody(spa.parent_block, src, child_block, prong_body, spa.switch_block_inst, merges);
                                            ^
/home/mitchell/src/zig/src/Sema.zig:13125:36: 0x4fa92ea in resolveSwitchComptime (main.zig)
    return spa.resolveProngComptime(
                                   ^
/home/mitchell/src/zig/src/Sema.zig:12929:34: 0x4f8e759 in resolveSwitchComptimeLoop (main.zig)
        if (resolveSwitchComptime(
                                 ^
/home/mitchell/src/zig/src/Sema.zig:11988:49: 0x46d57af in zirSwitchBlock (main.zig)
                return resolveSwitchComptimeLoop(
                                                ^
/home/mitchell/src/zig/src/Sema.zig:1250:69: 0x3b841d2 in analyzeBodyInner (main.zig)
            .switch_block                 => try sema.zirSwitchBlock(block, inst, false),
                                                                    ^
/home/mitchell/src/zig/src/Sema.zig:1044:26: 0x30098f1 in analyzeFnBody (main.zig)
    sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                         ^
/home/mitchell/src/zig/src/Sema.zig:7865:27: 0x4f3537a in analyzeCall (main.zig)
        sema.analyzeFnBody(&child_block, fn_zir_info.body) catch |err| switch (err) {
                          ^
/home/mitchell/src/zig/src/Sema.zig:6825:43: 0x4694890 in zirCall__anon_675116 (main.zig)
    const call_inst = try sema.analyzeCall(block, func, func_ty, callee_src, call_src, modifier, ensure_result_used, args_info, call_dbg_node, .call);
                                          ^
/home/mitchell/src/zig/src/Sema.zig:1182:62: 0x3b802ac in analyzeBodyInner (main.zig)
            .call                         => try sema.zirCall(block, inst, .direct),
                                                             ^
/home/mitchell/src/zig/src/Sema.zig:1044:26: 0x30098f1 in analyzeFnBody (main.zig)
    sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                         ^
/home/mitchell/src/zig/src/Sema.zig:7865:27: 0x4f3537a in analyzeCall (main.zig)
        sema.analyzeFnBody(&child_block, fn_zir_info.body) catch |err| switch (err) {
                          ^
/home/mitchell/src/zig/src/Sema.zig:6825:43: 0x4694890 in zirCall__anon_675116 (main.zig)
    const call_inst = try sema.analyzeCall(block, func, func_ty, callee_src, call_src, modifier, ensure_result_used, args_info, call_dbg_node, .call);
                                          ^
/home/mitchell/src/zig/src/Sema.zig:1182:62: 0x3b802ac in analyzeBodyInner (main.zig)
            .call                         => try sema.zirCall(block, inst, .direct),
                                                             ^
/home/mitchell/src/zig/src/Sema.zig:1044:26: 0x30098f1 in analyzeFnBody (main.zig)
    sema.analyzeBodyInner(block, body) catch |err| switch (err) {
                         ^
/home/mitchell/src/zig/src/Zcu/PerThread.zig:2934:23: 0x300e7bb in analyzeFnBodyInner (main.zig)
    sema.analyzeFnBody(&inner_block, fn_info.body) catch |err| switch (err) {
                      ^
/home/mitchell/src/zig/src/Zcu/PerThread.zig:1710:40: 0x2936044 in analyzeFuncBody (main.zig)
    var air = try pt.analyzeFnBodyInner(func_index);
                                       ^
/home/mitchell/src/zig/src/Zcu/PerThread.zig:1630:66: 0x230dce8 in ensureFuncBodyUpToDate (main.zig)
    const ies_outdated, const new_failed = if (pt.analyzeFuncBody(func_index)) |result|
                                                                 ^
/home/mitchell/src/zig/src/Compilation.zig:5131:38: 0x208757c in processOneJob (main.zig)
            pt.ensureFuncBodyUpToDate(func) catch |err| switch (err) {
                                     ^
/home/mitchell/src/zig/src/Compilation.zig:5001:30: 0x1e976cc in performAllTheWork (main.zig)
            try processOneJob(@intFromEnum(Zcu.PerThread.Id.main), comp, job);
                             ^
/home/mitchell/src/zig/src/Compilation.zig:3087:31: 0x1d32f34 in update (main.zig)
    try comp.performAllTheWork(main_progress_node);
                              ^
/home/mitchell/src/zig/src/main.zig:4134:32: 0x1be4258 in serve (main.zig)
                try comp.update(main_progress_node);
                               ^
/home/mitchell/src/zig/src/main.zig:3571:22: 0x1c1acc3 in buildOutputType (main.zig)
            try serve(
                     ^
/home/mitchell/src/zig/src/main.zig:263:31: 0x1c7e6ba in mainArgs (main.zig)
        return buildOutputType(gpa, arena, args, .{ .build = .Exe });
                              ^
/home/mitchell/src/zig/src/main.zig:204:20: 0x1b65619 in main (main.zig)
    return mainArgs(gpa, arena, args);
                   ^
/home/mitchell/src/zig/lib/std/start.zig:627:37: 0x1b63011 in main (std.zig)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x7f80e5e2a4d7 in ??? (libc.so.6)
Unwind information for `libc.so.6:0x7f80e5e2a4d7` was not available, trace may be incomplete

???:?:?: 0x7f80e5e2a59a in ??? (libc.so.6)
???:?:?: 0x6f40964 in ??? (???)

error: the following command terminated unexpectedly:
/home/mitchell/src/zig/zig-out/bin/zig build-exe /home/mitchell/src/burrito/src/xz/xz_crc32.c /home/mitchell/src/burrito/src/xz/xz_dec_lzma2.c /home/mitchell/src/burrito/src/xz/xz_dec_stream.c -OReleaseSmall -target x86_64-linux -mcpu baseline -I /home/mitchell/src/burrito/src/xz --dep build_options --dep burrito_plugin -Mroot=/home/mitchell/src/burrito/src/wrapper.zig -Mbuild_options=.zig-cache/c/e90551571b48a30c6577938ffa33215d/options.zig -Mburrito_plugin=/home/mitchell/src/burrito/_dummy_plugin.zig -lc --cache-dir .zig-cache --global-cache-dir /home/mitchell/.cache/zig --name expert --zig-lib-dir /home/mitchell/src/zig/lib/ --listen=-

Build Summary: 1/4 steps succeeded; 1 failed
install transitive failure
mq install expert transitive failure
   mq compile exe expert ReleaseSmall x86_64-linux failure

error: the following build command failed with exit code 1:
.zig-cache/o/e2284c1edb16b78e260fcf39615208f9/build /home/mitchell/src/zig/zig-out/bin/zig /home/mitchell/src/zig/lib /home/mitchell/src/burrito .zig-cache /home/mitchell/.cache/zig --seed 0x9409cca1 -Zb8d74fe33429ab21 -Dtarget=x86_64-linux -Dcpu=baseline

I hope this information is enough and I really appreciate everyone's time.

Thanks!

Expected Behavior

Can compile our project successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions