Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stage1 compiler segfaults when using @call() function #12851

Open
snoire opened this issue Sep 15, 2022 · 0 comments
Open

stage1 compiler segfaults when using @call() function #12851

snoire opened this issue Sep 15, 2022 · 0 comments
Labels
backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working. upstream An issue with a third party project that Zig uses.
Milestone

Comments

@snoire
Copy link
Contributor

snoire commented Sep 15, 2022

Zig Version

0.10.0-dev.4060+61aaef0b0

Steps to Reproduce

Put the following code in a file kernel.zig:

export var stack_bytes: [16 * 1024]u8 align(16) linksection(".bss") = undefined;
const stack_bytes_slice = stack_bytes[0..];

export fn _start() callconv(.Naked) noreturn {
    @call(.{ .stack = stack_bytes_slice }, kmain, .{});
}

fn kmain() noreturn {
    while (true) {}
}

Compile the code:

zig build-exe -fstage1 kernel.zig -target i386-freestanding

Expected Behavior

Compiles successfully

Actual Behavior

segmentation fault (core dumped)  zig build-exe -fstage1 kernel.zig -target i386-freestanding

additional note:
zig 0.10.0-dev.3986+e323cf126 can compile the code without error.

@snoire snoire added the bug Observed behavior contradicts documented or intended behavior label Sep 15, 2022
@Vexu Vexu added upstream An issue with a third party project that Zig uses. backend-llvm The LLVM backend outputs an LLVM IR Module. regression It worked in a previous version of Zig, but stopped working. labels Sep 15, 2022
@Vexu Vexu added this to the 0.11.0 milestone Sep 15, 2022
@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working. upstream An issue with a third party project that Zig uses.
Projects
None yet
Development

No branches or pull requests

3 participants