12101111 opened issue #13959:
Test Case
Reduce from libsodium
kxusingwasm-tools shrink(module (type (;0;) (func (param i32 i32))) (type (;1;) (func (param i32 i32 i32))) (memory (;0;) 2) (func (;0;) (type 1) (param i32 i32 i32)) (func (;1;) (type 0) (param i32 i32) (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) loop ;; label = @1 i32.const 0 local.get 1 i32.store8 local.get 3 br_if 0 (;@1;) end i32.const 1 local.get 0 i32.store8 local.get 0 local.get 0 i32.store8 loop ;; label = @1 local.get 0 local.get 0 i32.store8 local.get 1 local.get 4 i32.store8 i32.const 0 br_if 0 (;@1;) end loop ;; label = @1 i32.const 0 local.get 1 i32.store8 local.get 1 br_if 0 (;@1;) end i32.const 0 i32.const 1 i32.store8 offset=351 i32.const 1 i32.const 0 i32.const 40 memory.fill local.get 6 i32.const 1 i32.store local.get 6 local.get 6 local.get 6 memory.fill local.get 6 i32.const 1 i32.store local.get 6 i32.const 0 i32.const 0 memory.fill loop ;; label = @1 local.get 1 local.get 1 local.get 1 call 8 local.get 5 local.get 5 local.get 5 call 7 local.get 6 i32.const 1 call 5 i32.const 0 br_if 0 (;@1;) end i32.const 1 local.get 6 i32.const 40 memory.copy local.get 5 local.get 5 i32.const 1 memory.copy local.get 5 local.get 5 i32.const 0 memory.copy local.get 1 local.get 1 call 6 local.get 1 local.get 4 call 4 local.get 1 local.get 1 call 6 local.get 1 local.get 4 call 4 i32.const 0 i32.const 1 call 6 local.get 1 local.get 4 call 4 i32.const 1 i32.const 0 call 6 local.get 6 local.get 4 call 5 loop ;; label = @1 local.get 1 local.get 1 local.get 1 call 8 local.get 4 local.get 4 local.get 4 call 7 local.get 6 local.get 7 call 5 local.get 1 br_if 0 (;@1;) end nop local.get 2 local.get 2 i32.store offset=292 i32.const 0 local.get 18 i32.store offset=288 local.get 2 local.get 2 i32.store offset=284 local.get 2 local.get 14 i32.store offset=280 i32.const 0 local.get 12 i32.store offset=276 i32.const 0 local.get 10 i32.store offset=272 local.get 8 i32.const 1 i32.store offset=268 i32.const 0 i32.const 1 i32.store offset=264 local.get 2 local.get 2 i32.store offset=260 local.get 1 local.get 1 i32.store offset=256 local.get 2 i32.const 1 i32.store offset=244 local.get 2 i32.const 0 i32.store offset=240 local.get 2 i32.const 0 i32.store offset=236 i32.const 0 i32.const 0 i32.store offset=232 local.get 2 local.get 12 i32.store offset=228 local.get 2 local.get 10 i32.store offset=224 local.get 2 local.get 8 i32.store offset=220 local.get 2 local.get 4 i32.store offset=216 i32.const 0 local.get 5 i32.store offset=212 local.get 1 local.get 1 i32.store offset=208 local.get 2 local.get 1 call 3 local.get 1 local.get 1 local.get 1 call 0 local.get 0 local.get 2 call 2 ) (func (;2;) (type 0) (param i32 i32)) (func (;3;) (type 0) (param i32 i32)) (func (;4;) (type 0) (param i32 i32)) (func (;5;) (type 0) (param i32 i32)) (func (;6;) (type 0) (param i32 i32)) (func (;7;) (type 1) (param i32 i32 i32)) (func (;8;) (type 1) (param i32 i32 i32)) )Steps to Reproduce
wasmtime compile --target riscv64gc-unknown-linux-gnu kx.shrunken.wasmExpected Results
It should compile like wasmtime 45
Actual Results
thread '<unnamed>' (663301) panicked at /home/han/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cranelift-codegen-0.134.2/src/isa/riscv64/inst/args.rs:1271:18: internal error: entered unreachable code stack backtrace: 0: __rustc::rust_begin_unwind 1: core::panicking::panic_fmt 2: core::panicking::panic 3: cranelift_codegen::isa::riscv64::lower::isle::generated_code::constructor_gen_store::<cranelift_codegen::isa::riscv64::lower::isle::RV64IsleContext<cranelift_codegen::isa::riscv64::lower::isle::generated_code::MInst, cranelift_codegen::isa::riscv64::Riscv64Backend>> 4: cranelift_codegen::isa::riscv64::lower::isle::generated_code::constructor_lower::<cranelift_codegen::isa::riscv64::lower::isle::RV64IsleContext<cranelift_codegen::isa::riscv64::lower::isle::generated_code::MInst, cranelift_codegen::isa::riscv64::Riscv64Backend>> 5: <cranelift_codegen::isa::riscv64::Riscv64Backend as cranelift_codegen::machinst::lower::LowerBackend>::lower 6: cranelift_codegen::machinst::compile::compile::<cranelift_codegen::isa::riscv64::Riscv64Backend> 7: <cranelift_codegen::isa::riscv64::Riscv64Backend as cranelift_codegen::isa::TargetIsa>::compile_function 8: <cranelift_codegen::context::Context>::compile_stencil 9: <cranelift_codegen::context::Context>::compile 10: <wasmtime_internal_cranelift::compiler::FunctionCompiler>::finish_with_info 11: <wasmtime_internal_cranelift::compiler::Compiler as wasmtime_environ::compile::InliningCompiler>::finish_compiling 12: <&<wasmtime::engine::Engine>::run_maybe_parallel<alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a dyn wasmtime_environ::compile::Compiler + 'a,), Output = core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>> + core::marker::Send>, wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error, <wasmtime::compile::CompileInputs>::compile::{closure#0}>::{closure#0} as core::ops::function::FnMut<(alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a dyn wasmtime_environ::compile::Compiler + 'a,), Output = core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>> + core::marker::Send>,)>>::call_mut 13: <rayon::iter::collect::consumer::CollectResult<core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>> as rayon::iter::plumbing::Folder<core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>>>::consume_iter::<core::iter::adapters::map::Map<rayon::vec::SliceDrain<alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a dyn wasmtime_environ::compile::Compiler + 'a,), Output = core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>> + core::marker::Send>>, &<wasmtime::engine::Engine>::run_maybe_parallel<alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a dyn wasmtime_environ::compile::Compiler + 'a,), Output = core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>> + core::marker::Send>, wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error, <wasmtime::compile::CompileInputs>::compile::{closure#0}>::{closure#0}>> 14: rayon::iter::plumbing::bridge_producer_consumer::helper::<rayon::vec::DrainProducer<alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a dyn wasmtime_environ::compile::Compiler + 'a,), Output = core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>> + core::marker::Send>>, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>>, <wasmtime::engine::Engine>::run_maybe_parallel<alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a dyn wasmtime_environ::compile::Compiler + 'a,), Output = core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>> + core::marker::Send>, wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error, <wasmtime::compile::CompileInputs>::compile::{closure#0}>::{closure#0}>> 15: <rayon_core::job::StackJob<rayon_core::latch::SpinLatch, rayon_core::join::join_context::call_b<rayon::iter::collect::consumer::CollectResult<core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>>, rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a dyn wasmtime_environ::compile::Compiler + 'a,), Output = core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>> + core::marker::Send>>, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>>, <wasmtime::engine::Engine>::run_maybe_parallel<alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a dyn wasmtime_environ::compile::Compiler + 'a,), Output = core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>> + core::marker::Send>, wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error, <wasmtime::compile::CompileInputs>::compile::{closure#0}>::{closure#0}>>::{closure#1}>::{closure#0}, rayon::iter::collect::consumer::CollectResult<core::result::Result<wasmtime::compile::CompileOutput, wasmtime_internal_core::error::error::Error>>> as rayon_core::job::Job>::execute 16: <rayon_core::registry::WorkerThread>::wait_until_cold 17: <rayon_core::registry::ThreadBuilder>::runThe type entering unreachable branch is
types::I8X16.Ver
[message truncated]
12101111 added the bug label to Issue #13959.
alexcrichton commented on issue #13959:
Thanks! The cause of this is this line, specifically a fixed-length memcpy is expanded inline and that's what's using the
i8x16type. Thei8x16type, however, requires thehas_vRISC-V feature (e.g.-Ccranelift-has-von the CLI) and panics without it. Right now Wasmtime isn't the best about detecting this situation and issuing an error for it. Ideally we'd be able to plumb this around and understand that the WebAssembly simd feature requires the RISC-Vhas_vfeature, and additionally we'd be able to test that in this lowering to skipi8x16if it's not supported.
alexcrichton added the cranelift:area:riscv64 label to Issue #13959.
Last updated: Jul 29 2026 at 05:03 UTC