fixes
This commit is contained in:
23
examples/issue-0009.sx
Normal file
23
examples/issue-0009.sx
Normal file
@@ -0,0 +1,23 @@
|
||||
// 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");
|
||||
}
|
||||
Reference in New Issue
Block a user