Skip to content

broken LLVM module when directly awaiting a certain @asyncCall #5509

@courajs

Description

@courajs

Sorry for the large example, I had trouble reducing it:
https://gist.github.com/courajs/7815091c46d94cb9585f25832da4487c

broken LLVM module found: Instruction does not dominate all uses!
  %10 = getelementptr inbounds %"RunningGenerator(u8,u8,u8)", %"RunningGenerator(u8,u8,u8)"* %9, i32 0, i32 3, !dbg !2213
  %33 = getelementptr inbounds %"[]u8", %"[]u8"* %10, i32 0, i32 0, !dbg !2216
Instruction does not dominate all uses!
  %40 = getelementptr inbounds %"RunningGenerator(u8,u8,u8)", %"RunningGenerator(u8,u8,u8)"* %39, i32 0, i32 3, !dbg !2220
  %64 = getelementptr inbounds %"[]u8", %"[]u8"* %40, i32 0, i32 0, !dbg !2224

This is a bug in the Zig compiler.
Unable to dump stack trace: debug info stripped
generators...The following command terminated unexpectedly:
/usr/local/Cellar/zig/0.6.0_1/bin/zig build-exe /Users/aaron/dev/zig/generators/src/main.zig --cache-dir /Users/aaron/dev/zig/generators/zig-cache --name generators --cache on

Build failed. The following command failed:
/Users/aaron/dev/zig/generators/zig-cache/o/oMByx-gNppEQTgYvwtZpRnNUX5q_awT1z3mpznAuuVyXAfkub9BPM46rvNJGkAU0/build /usr/local/Cellar/zig/0.6.0_1/bin/zig /Users/aaron/dev/zig/generators /Users/aaron/dev/zig/generators/zig-cache run

shell returned 6

If you change lines 106 & 108 to store the return of @asyncCall in a variable, it works as expected:

var n = await @asyncCall(target.yield_frame, {}, yield, target, 0);

->

var f = @asyncCall(target.yield_frame, {}, yield, target, 0);
var n = await f;

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