Skip to content

Cross-Compiling for Windows breaks error stack traces #12729

Open
@nolanderc

Description

@nolanderc

Zig Version

0.10.0-dev.3857+10e11b60e

Steps to Reproduce

mkdir zig-test && cd zig-test
zig init-exe

and replace src/main.zig with the following:

const std = @import("std");

pub fn main() !void {
    std.log.info("running on thread {}", .{std.Thread.getCurrentId()});
    return error.Whatever;
}

Then build the program on a non-windows OS (tested using Ubuntu 20.04 through WSL2):

zig build -Dtarget=x86_64-windows

Expected Behavior

The program should terminate with a message containing the error and a stack trace showing where the error originated from. For example, this is the result when on WSL2 using zig build run:

info: running on thread 24663
error: Whatever
/home/christofer/dev/tmp/zig-test/src/main.zig:5:5: 0x20d416 in main (zig-test)
    return error.Whatever;
    ^

Actual Behavior

Attempting to run this program on a Windows machine (tested on Windows 11 build 22000.856) produces the following output:

info: running on thread 32448
error: Whatever
thread 32448 panic: reached unreachable code
Panicked during a panic. Aborting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-x86_6464-bit x86bugObserved behavior contradicts documented or intended behavioros-windows

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions