Stream: git-wasmtime

Topic: wasmtime / issue #12865 Cranelift: `InstBuilder::br_table...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2026 at 08:54):

ultimaweapon opened issue #12865:

The default branch and all branches that was passed to JumpTableData::new is not sealed. I'm not sure what I did wrong here so I file a bug report.

Steps to Reproduce

I put the code to reproduce the bug in https://github.com/ultimaweapon/cranelift-bug.

Expected Results

The br_table call success without assertion failed.

Actual Results

thread 'main' (86173) panicked at /home/ultimaweapon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cranelift-frontend-0.130.0/src/ssa.rs:371:9:
assertion failed: !self.is_sealed(block)
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library/std/src/panicking.rs:689:5
   1: core::panicking::panic_fmt
             at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library/core/src/panicking.rs:80:14
   2: core::panicking::panic
             at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library/core/src/panicking.rs:150:5
   3: cranelift_frontend::ssa::SSABuilder::declare_block_predecessor
             at /home/ultimaweapon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cranelift-frontend-0.130.0/src/ssa.rs:371:9
   4: <cranelift_frontend::frontend::FuncInstBuilder as cranelift_codegen::ir::builder::InstBuilderBase>::build
             at /home/ultimaweapon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cranelift-frontend-0.130.0/src/frontend.rs:178:26
   5: cranelift_codegen::ir::builder::InstBuilder::BranchTable
             at ./target/debug/build/cranelift-codegen-bd879e5a29161344/out/inst_builder.rs:4275:14
   6: cranelift_codegen::ir::builder::InstBuilder::br_table
             at ./target/debug/build/cranelift-codegen-bd879e5a29161344/out/inst_builder.rs:79:32
   7: cranelift_bug::main
             at ./src/main.rs:80:14
   8: core::ops::function::FnOnce::call_once
             at /home/ultimaweapon/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5

Versions and Environment

Cranelift version or commit: 0.130.0
Operating system: Arch Linux
Architecture: x86-64

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2026 at 08:54):

ultimaweapon added the bug label to Issue #12865.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2026 at 08:54):

ultimaweapon added the cranelift label to Issue #12865.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2026 at 09:18):

bjorn3 commented on issue #12865:

You need to use the ValueListPool that is inside the Function you are building (func.dfg.value_lists), not create your own. The JumpTableData contains indices into the ValueListPool and FunctionBuilder uses these indices on the ValueListPool stored inside the Function, which will cause it to be interpreted as jumping to an entirely different block that just so happens to already be sealed.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2026 at 09:41):

ultimaweapon commented on issue #12865:

Thanks for the information. Changing BlockCall::new to fb.func.dfg.block_call fixed the problem (which effectively use func.dfg.value_lists). Is this the correct way to construct a BlockCall? To me it seems like calling into a private API of Cranelift.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2026 at 10:59):

bjorn3 commented on issue #12865:

Is this the correct way to construct a BlockCall?

Yes

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2026 at 11:43):

ultimaweapon closed issue #12865:

The default branch and all branches that was passed to JumpTableData::new is not sealed. I'm not sure what I did wrong here so I file a bug report.

Steps to Reproduce

I put the code to reproduce the bug in https://github.com/ultimaweapon/cranelift-bug.

Expected Results

The br_table call success without assertion failed.

Actual Results

thread 'main' (86173) panicked at /home/ultimaweapon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cranelift-frontend-0.130.0/src/ssa.rs:371:9:
assertion failed: !self.is_sealed(block)
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library/std/src/panicking.rs:689:5
   1: core::panicking::panic_fmt
             at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library/core/src/panicking.rs:80:14
   2: core::panicking::panic
             at /rustc/e408947bfd200af42db322daf0fadfe7e26d3bd1/library/core/src/panicking.rs:150:5
   3: cranelift_frontend::ssa::SSABuilder::declare_block_predecessor
             at /home/ultimaweapon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cranelift-frontend-0.130.0/src/ssa.rs:371:9
   4: <cranelift_frontend::frontend::FuncInstBuilder as cranelift_codegen::ir::builder::InstBuilderBase>::build
             at /home/ultimaweapon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cranelift-frontend-0.130.0/src/frontend.rs:178:26
   5: cranelift_codegen::ir::builder::InstBuilder::BranchTable
             at ./target/debug/build/cranelift-codegen-bd879e5a29161344/out/inst_builder.rs:4275:14
   6: cranelift_codegen::ir::builder::InstBuilder::br_table
             at ./target/debug/build/cranelift-codegen-bd879e5a29161344/out/inst_builder.rs:79:32
   7: cranelift_bug::main
             at ./src/main.rs:80:14
   8: core::ops::function::FnOnce::call_once
             at /home/ultimaweapon/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5

Versions and Environment

Cranelift version or commit: 0.130.0
Operating system: Arch Linux
Architecture: x86-64

view this post on Zulip Wasmtime GitHub notifications bot (Mar 29 2026 at 11:43):

ultimaweapon commented on issue #12865:

In that case I'll close this issue. Thanks for confirmation.


Last updated: Apr 12 2026 at 23:10 UTC