Skip to content

compiler assertion with x86_64 native backend #22974

@actondev

Description

@actondev

Zig Version

0.14.0-dev.3299+31f353cd9

Steps to Reproduce and Observed Behavior

I've been trying lately to see if I can use the native backend in my application, but it keeps crashing.

        const exe = b.addExecutable(.{
            ...
            .use_llvm = optimize != .Debug,
            .use_lld = optimize != .Debug,
});

By compiling latest master, This is what I get.

error: thread 106850 panic: reached unreachable code
/home/actondev/dev/cloned/zig/lib/std/debug.zig:518:14: 0x19327fd in assert (zig)
    if (!ok) unreachable; // assertion failure
             ^
/home/actondev/dev/cloned/zig/src/Value.zig:135:11: 0x1b56d0e in fromInterned (zig)
    assert(i != .none);
          ^
/home/actondev/dev/cloned/zig/src/link/Dwarf.zig:3860:66: 0x2835e05 in updateLazyValue (zig)
                    try wip_nav.blockValue(src_loc, .fromInterned(opt.val));
                                                                 ^
/home/actondev/dev/cloned/zig/src/link/Dwarf.zig:2059:54: 0x23b28dd in updateLazy (zig)
            else => try wip_nav.dwarf.updateLazyValue(wip_nav.pt, src_loc, val, &wip_nav.pending_lazy),
                                                     ^
/home/actondev/dev/cloned/zig/src/link/Dwarf.zig:3124:27: 0x2ccf335 in updateComptimeNavInner (zig)
    try wip_nav.updateLazy(nav_src_loc);
                          ^
/home/actondev/dev/cloned/zig/src/link/Dwarf.zig:2683:34: 0x2797576 in updateComptimeNav (zig)
    return updateComptimeNavInner(dwarf, pt, nav_index) catch |err| switch (err) {
                                 ^
/home/actondev/dev/cloned/zig/src/link/Elf/ZigObject.zig:1601:64: 0x235110c in updateNav (zig)
    } else if (self.dwarf) |*dwarf| try dwarf.updateComptimeNav(pt, nav_index);
                                                               ^
/home/actondev/dev/cloned/zig/src/link/Elf.zig:2382:43: 0x1f47bee in updateNav (zig)
    return self.zigObjectPtr().?.updateNav(self, pt, nav);
                                          ^
/home/actondev/dev/cloned/zig/src/link.zig:706:81: 0x1cf7ae0 in updateNav (zig)
                return @as(*tag.Type(), @fieldParentPtr("base", base)).updateNav(pt, nav_index);
                                                                                ^
/home/actondev/dev/cloned/zig/src/Zcu/PerThread.zig:3128:21: 0x1b54bba in linkerUpdateNav (zig)
        lf.updateNav(pt, nav_index) catch |err| switch (err) {
                    ^
/home/actondev/dev/cloned/zig/src/link.zig:1566:35: 0x22d036d in doTask (zig)
                pt.linkerUpdateNav(nav_index) catch |err| switch (err) {
                                  ^
/home/actondev/dev/cloned/zig/src/link.zig:1384:34: 0x1ef7da2 in flushTaskQueue (zig)
        for (tasks) |task| doTask(comp, tid, task);
                                 ^
/home/actondev/dev/cloned/zig/lib/std/Thread/Pool.zig:182:50: 0x1ef7fb9 in runFn (zig)
            @call(.auto, func, .{id.?} ++ closure.arguments);
                                                 ^
/home/actondev/dev/cloned/zig/lib/std/Thread/Pool.zig:295:32: 0x1ea75a4 in worker (zig)
            run_node.data.runFn(&run_node.data, id);
                               ^
/home/actondev/dev/cloned/zig/lib/std/Thread.zig:488:13: 0x1c88dba in callFn__anon_171278 (zig)
            @call(.auto, f, args);
            ^
/home/actondev/dev/cloned/zig/lib/std/Thread.zig:757:30: 0x1b0b634 in entryFn (zig)
                return callFn(f, args_ptr.*);
                             ^
???:?:?: 0x73f6c56a3709 in ??? (libc.so.6)
Unwind information for `libc.so.6:0x73f6c56a3709` was not available, trace may be incomplete

I'm linking with c & c++ libraries FYI. I don't have my application open source anywhere. Let me know if I can help debugging this some way.

Expected Behavior

Compilation should work

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions