Skip to content

broken llvm module when inlining an await expression #7902

@emekoi

Description

@emekoi

zig commit: 236db62

fn alert(msg_ptr: [*]const u8, msg_len: usize) void {}

fn asyncFn(a: usize) callconv(.Async) usize {
    return a;
}

fn amain() void {
    const str = "hello";
    var v = async asyncFn(1);
    var zero: usize = 0;
    alert(str[zero..].ptr, await v);
}

pub fn main() void {
    _ = async amain();
}

this seems to be caused by the fact that the first parameter of alert is of type [*]const u8. changing the type or removing the first parameter seems to fix the compilation error. assigning the value of the await expression to a temporary variable also fixes the problem.

fn alert(msg_ptr: [*]const u8, msg_len: usize) void {}

fn asyncFn(a: usize) callconv(.Async) usize {
    return a;
}

fn amain() void {
    const str = "hello";
    var v = async asyncFn(1);
    var zero: usize = 0;
    var tmp = await v;
    alert(str[zero..].ptr, tmp);
}

pub fn main() void {
    _ = async amain();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions