From c4c6e4d2ee4e46196510ef196026f5ae2b985088 Mon Sep 17 00:00:00 2001 From: cl507523 Date: Thu, 26 Feb 2026 09:28:05 +0000 Subject: [PATCH] fix(evm): skip JUMPDEST skip-cost metering when in dead code When a consecutive JUMPDEST run follows dead code (e.g., after an unconditional JUMP), meterOpcodeRange was called while CurBB was already terminated. This appended gas-metering instructions (including a BrIfInstruction terminator) after the existing terminator, creating a basic block with two terminators. LLVM's MC assembler then emitted a branch to the ContinueBB label but never defined it (the block was unreachable), producing "Undefined temporary symbol .LBB0_43". Guard the meterOpcodeRange call with !InDeadCode. When execution reaches a JUMPDEST via an indirect jump, the per-target entry thunks already charge the correct skip cost, so the linear-path metering is unnecessary and incorrect in the dead-code case. Made-with: Cursor --- src/action/evm_bytecode_visitor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/action/evm_bytecode_visitor.h b/src/action/evm_bytecode_visitor.h index fbd184a2..fc639044 100644 --- a/src/action/evm_bytecode_visitor.h +++ b/src/action/evm_bytecode_visitor.h @@ -596,7 +596,7 @@ template class EVMByteCodeVisitor { Ip++; PC++; } - if (PC > RunStartPC) { + if (PC > RunStartPC && !InDeadCode) { Builder.meterOpcodeRange(RunStartPC, PC); } handleEndBlock();