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

unable to call function with a new stack with a runtime known new stack slice #3857

Closed
andrewrk opened this issue Dec 6, 2019 · 2 comments
Closed
Labels
bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend.
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Dec 6, 2019

With the merge of #3856, calling a function with a new stack regressed a bit:

export fn entry() void {
    var buf: [10]u8 align(16) = undefined;
    @call(.{.stack = &buf}, foo, .{});
}
fn foo() void {}

Used to be OK, now gives:

/home/andy/dev/zig/build/test.zig:3:5: error: unable to evaluate constant expression
    @call(.{ .stack = &buf }, foo, .{});
    ^

Need more Runtime Hint Propagation to make this work. However this is a low priority because it's not clear this feature is going to make it into zig.

Above example works if you make the memory global:

var buf: [10]u8 align(16) = undefined;
export fn entry() void {
    @call(.{.stack = &buf}, foo, .{});
}
fn foo() void {}
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend. labels Dec 6, 2019
@andrewrk andrewrk added this to the 0.7.0 milestone Dec 6, 2019
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Aug 13, 2020
@RaphiJS6-13
Copy link

I hate this bug. @call is a great feature, but now it's broken.

@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Nov 6, 2020
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 May 19, 2021
@Vexu
Copy link
Member

Vexu commented Dec 28, 2022

Stack option removed in #13907

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend.
Projects
None yet
Development

No branches or pull requests

3 participants