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

using await in an expression generates invalid LLVM IR #3077

Closed
andrewrk opened this issue Aug 16, 2019 · 0 comments
Closed

using await in an expression generates invalid LLVM IR #3077

andrewrk opened this issue Aug 16, 2019 · 0 comments
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

const std = @import("std");
const expect = std.testing.expect;

test "await in expression" {
    _ = async atest();
}

fn atest() void {
    var f1 = async add(1, 2);
    var f2 = async add(3, 4);

    const sum = (await f1) + (await f2);
    expect(sum == 10);
}
fn add(a: i32, b: i32) i32 {
    return a + b;
}

Expected to pass. Instead:

Instruction does not dominate all uses!
  %21 = load i32, i32* %2, align 4, !dbg !1003
  %33 = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %21, i32 %32), !dbg !1006
LLVM ERROR: Broken module found, compilation aborted!

Implementation needs to spill the intermediate values.

@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 Aug 16, 2019
@andrewrk andrewrk added this to the 0.5.0 milestone Aug 16, 2019
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

1 participant