The compiler panics with index out of bounds: the len is 0 but the index is 0 in src/codegen/dead_storage.rs (reaching_definitions) when a Yul for loop's body consists only of a continue. The lowering produces a basic block whose block_vars entry is an empty Vec<ReachingDefs>, and the dataflow code unconditionally indexes [0] into it.
MRE:
contract C {
function f() public pure {
assembly {
for { let i := 0 } lt(i, 1) { i := add(i, 1) } { continue }
}
}
}
Reproduce: save as mre.sol, run solang compile --target polkadot mre.sol.
Output:
thread 'main' panicked at src/codegen/dead_storage.rs:NNN:
index out of bounds: the len is 0 but the index is 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Expected behavior: codegen handles the empty-body / bare-continue Yul for loop without panicking (the loop is a no-op and should compile cleanly).
Reproduces on all three targets that support Yul (polkadot, solana, evm).
Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)
The compiler panics with
index out of bounds: the len is 0 but the index is 0insrc/codegen/dead_storage.rs(reaching_definitions) when a Yulforloop's body consists only of acontinue. The lowering produces a basic block whoseblock_varsentry is an emptyVec<ReachingDefs>, and the dataflow code unconditionally indexes[0]into it.MRE:
Reproduce: save as
mre.sol, runsolang compile --target polkadot mre.sol.Output:
Expected behavior: codegen handles the empty-body / bare-
continueYulforloop without panicking (the loop is a no-op and should compile cleanly).Reproduces on all three targets that support Yul (
polkadot,solana,evm).Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)