commit 30ec163d14245ac392ccb3cc65220a89cded8576 (tree)
parent 76e2764eb1405eabe53b10bccdde7684432c4596
Author: Luna Schwalbe <dev@luna.gl>
Date: Wed, 27 Aug 2025 19:09:05 +0200
BitcodeReader: parse blockinfo inside block
Call start/endBlock before/after `parseBlockInfoBlock` in order to not
use the current block context, which is wrong and leads to e.g. incorrect
abbrevlen being used.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/std/zig/llvm/BitcodeReader.zig b/lib/std/zig/llvm/BitcodeReader.zig
@@ -154,7 +154,11 @@ pub fn next(bc: *BitcodeReader) !?Item {
Abbrev.Builtin.enter_subblock.toRecordId() => {
const block_id: u32 = @intCast(record.operands[0]);
switch (block_id) {
- Block.block_info => try bc.parseBlockInfoBlock(),
+ Block.block_info => {
+ try bc.startBlock(Block.block_info, @intCast(record.operands[1]));
+ try bc.parseBlockInfoBlock();
+ try bc.endBlock();
+ },
Block.first_reserved...Block.last_standard => return error.UnsupportedBlockId,
else => {
try bc.startBlock(block_id, @intCast(record.operands[1]));