ultimaweapon opened issue #12865:
The default branch and all branches that was passed to
JumpTableData::newis 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_tablecall 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:5Versions and Environment
Cranelift version or commit: 0.130.0
Operating system: Arch Linux
Architecture: x86-64
ultimaweapon added the bug label to Issue #12865.
ultimaweapon added the cranelift label to Issue #12865.
bjorn3 commented on issue #12865:
You need to use the
ValueListPoolthat is inside theFunctionyou are building (func.dfg.value_lists), not create your own. TheJumpTableDatacontains indices into theValueListPoolandFunctionBuilderuses these indices on theValueListPoolstored inside theFunction, which will cause it to be interpreted as jumping to an entirely different block that just so happens to already be sealed.
ultimaweapon commented on issue #12865:
Thanks for the information. Changing
BlockCall::newtofb.func.dfg.block_callfixed the problem (which effectively usefunc.dfg.value_lists). Is this the correct way to construct aBlockCall? To me it seems like calling into a private API of Cranelift.
bjorn3 commented on issue #12865:
Is this the correct way to construct a BlockCall?
Yes
ultimaweapon closed issue #12865:
The default branch and all branches that was passed to
JumpTableData::newis 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_tablecall 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:5Versions and Environment
Cranelift version or commit: 0.130.0
Operating system: Arch Linux
Architecture: x86-64
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