authorgravatar for dev@luna.glLuna Schwalbe <dev@luna.gl> 2025-08-27 19:09:05+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-09-03 21:47:32-07:00
log9649ff37ef15aae06d4020ce3b7210fa2aaf2a25
treea33833a8675bfad5a0d3340a4e691e3e12b969f8
parentae518dcb41ac6a403f04939e0d119a8c4b3c9737

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.

1 files changed, 5 insertions(+), 1 deletions(-)

lib/std/zig/llvm/BitcodeReader.zig+5-1
......@@ -154,7 +154,11 @@ pub fn next(bc: *BitcodeReader) !?Item {
154154 Abbrev.Builtin.enter_subblock.toRecordId() => {
155155 const block_id: u32 = @intCast(record.operands[0]);
156156 switch (block_id) {
157 Block.block_info => try bc.parseBlockInfoBlock(),
157 Block.block_info => {
158 try bc.startBlock(Block.block_info, @intCast(record.operands[1]));
159 try bc.parseBlockInfoBlock();
160 try bc.endBlock();
161 },
158162 Block.first_reserved...Block.last_standard => return error.UnsupportedBlockId,
159163 else => {
160164 try bc.startBlock(block_id, @intCast(record.operands[1]));