authorgravatar for dev@luna.glLuna Schwalbe <dev@luna.gl> 2025-08-27 19:09:05+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-07 00:34:14+02:00
log30ec163d14245ac392ccb3cc65220a89cded8576
treeed8b1a1a70c51d25caaba0801609730494cc2505
parent76e2764eb1405eabe53b10bccdde7684432c4596
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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 {...@@ -154,7 +154,11 @@ pub fn next(bc: *BitcodeReader) !?Item {
154 Abbrev.Builtin.enter_subblock.toRecordId() => {154 Abbrev.Builtin.enter_subblock.toRecordId() => {
155 const block_id: u32 = @intCast(record.operands[0]);155 const block_id: u32 = @intCast(record.operands[0]);
156 switch (block_id) {156 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 },
158 Block.first_reserved...Block.last_standard => return error.UnsupportedBlockId,162 Block.first_reserved...Block.last_standard => return error.UnsupportedBlockId,
159 else => {163 else => {
160 try bc.startBlock(block_id, @intCast(record.operands[1]));164 try bc.startBlock(block_id, @intCast(record.operands[1]));