24 lines
837 B
Plaintext
24 lines
837 B
Plaintext
// issue-0009: `push` with Context containing inline protocol triggers LLVM verification error
|
|
//
|
|
// LLVM verification failed: Invalid InsertValueInst operands!
|
|
// %si24 = insertvalue { ptr, ptr, ptr } undef, { ptr, ptr, ptr } %si21, 0
|
|
//
|
|
// Context contains `allocator: Allocator` where `Allocator :: protocol #inline`.
|
|
// push saves/restores context as a value, but LLVM lowering mishandles the struct
|
|
// when the first field is an inline protocol cast from a different impl (Arena).
|
|
|
|
#import "modules/std.sx";
|
|
#import "modules/allocators.sx";
|
|
|
|
main :: () -> void {
|
|
arena : Arena = ---;
|
|
arena.create(context.allocator, 4096);
|
|
|
|
new_ctx := Context.{ allocator = xx @arena, data = context.data };
|
|
push new_ctx {
|
|
ptr := context.allocator.alloc(128);
|
|
out("inside push\n");
|
|
}
|
|
out("after push\n");
|
|
}
|