afonso360 labeled issue #3100:
Hey, While working on implementing
br_table
's for the interpreter i found the following test case that crashes on the x64 backend. This test case passes on s390x and aarch64, and on x64 it only fails for the i64 data type, it passes on i32, i16 and i8's.
.clif
Test Casetest run target x86_64 machinst function %br_table_i64(i64) -> i64 { jt0 = jump_table [block1, block2, block2, block3] block0(v0: i64): br_table v0, block4, jt0 block1: v1 = iconst.i64 1 jump block5(v1) block2: v2 = iconst.i64 2 jump block5(v2) block3: v3 = iconst.i64 3 jump block5(v3) block4: v4 = iconst.i64 4 jump block5(v4) block5(v5: i64): v6 = iadd.i64 v0, v5 return v6 } ; run: %br_table_i64(0) == 1 ; run: %br_table_i64(1) == 3 ; run: %br_table_i64(2) == 4 ; run: %br_table_i64(3) == 6 ; run: %br_table_i64(4) == 8 ; run: %br_table_i64(5) == 9 ; run: %br_table_i64(6) == 10 ; run: %br_table_i64(-1) == 3
Expected Results
This test case to pass.
Actual Results
This crashes with the following error:
thread 'worker #0' panicked at 'invalid extension: 64 -> 32', cranelift\codegen\src\isa\x64\lower.rs:233:38 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\std\src\panicking.rs:515 1: core::panicking::panic_fmt at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\core\src\panicking.rs:92 2: core::option::expect_failed at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\core\src\option.rs:1243 3: enum$<core::option::Option<enum$<cranelift_codegen::isa::x64::inst::args::ExtMode>>, 0, 4, Some>::expect<enum$<cranelift_codegen::isa::x64::inst::args::ExtMode>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\core\src\option.rs:351 4: cranelift_codegen::isa::x64::lower::extend_input_to_reg<cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>> at .\codegen\src\isa\x64\lower.rs:233 5: cranelift_codegen::isa::x64::lower::{{impl}}::lower_branch_group<cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>> at .\codegen\src\isa\x64\lower.rs:6843 6: cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>::lower_clif_branches<enum$<cranelift_codegen::isa::x64::inst::Inst>,cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\lower.rs:880 7: cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>::lower<enum$<cranelift_codegen::isa::x64::inst::Inst>,cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\lower.rs:955 8: cranelift_codegen::machinst::compile::compile<cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\compile.rs:30 9: cranelift_codegen::isa::x64::X64Backend::compile_vcode at .\codegen\src\isa\x64\mod.rs:51 10: cranelift_codegen::isa::x64::{{impl}}::compile_function at .\codegen\src\isa\x64\mod.rs:62 11: cranelift_codegen::context::Context::compile at .\codegen\src\context.rs:197 12: cranelift_filetests::function_runner::compile at .\filetests\src\function_runner.rs:286 13: cranelift_filetests::function_runner::SingleFunctionCompiler::compile at .\filetests\src\function_runner.rs:77 14: cranelift_filetests::test_run::{{impl}}::run at .\filetests\src\test_run.rs:61 15: cranelift_filetests::runone::run_one_test at .\filetests\src\runone.rs:188 16: cranelift_filetests::runone::run at .\filetests\src\runone.rs:132 17: cranelift_filetests::concurrent::worker_thread::{{closure}}::{{closure}} at .\filetests\src\concurrent.rs:150 18: std::panicking::try::do_call<closure-0,enum$<core::result::Result<core::time::Duration, anyhow::Error>>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panicking.rs:401 19: std::panicking::try::do_catch<std::panic::AssertUnwindSafe<closure-0>,tuple<>> 20: std::panicking::try<enum$<core::result::Result<core::time::Duration, anyhow::Error>>,closure-0> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panicking.rs:365 21: std::panic::catch_unwind<closure-0,enum$<core::result::Result<core::time::Duration, anyhow::Error>>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panic.rs:434 22: cranelift_filetests::concurrent::worker_thread::{{closure}} at .\filetests\src\concurrent.rs:150 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
afonso360 opened issue #3100:
Hey, While working on implementing
br_table
's for the interpreter i found the following test case that crashes on the x64 backend. This test case passes on s390x and aarch64, and on x64 it only fails for the i64 data type, it passes on i32, i16 and i8's.
.clif
Test Casetest run target x86_64 machinst function %br_table_i64(i64) -> i64 { jt0 = jump_table [block1, block2, block2, block3] block0(v0: i64): br_table v0, block4, jt0 block1: v1 = iconst.i64 1 jump block5(v1) block2: v2 = iconst.i64 2 jump block5(v2) block3: v3 = iconst.i64 3 jump block5(v3) block4: v4 = iconst.i64 4 jump block5(v4) block5(v5: i64): v6 = iadd.i64 v0, v5 return v6 } ; run: %br_table_i64(0) == 1 ; run: %br_table_i64(1) == 3 ; run: %br_table_i64(2) == 4 ; run: %br_table_i64(3) == 6 ; run: %br_table_i64(4) == 8 ; run: %br_table_i64(5) == 9 ; run: %br_table_i64(6) == 10 ; run: %br_table_i64(-1) == 3
Expected Results
This test case to pass.
Actual Results
This crashes with the following error:
thread 'worker #0' panicked at 'invalid extension: 64 -> 32', cranelift\codegen\src\isa\x64\lower.rs:233:38 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\std\src\panicking.rs:515 1: core::panicking::panic_fmt at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\core\src\panicking.rs:92 2: core::option::expect_failed at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\core\src\option.rs:1243 3: enum$<core::option::Option<enum$<cranelift_codegen::isa::x64::inst::args::ExtMode>>, 0, 4, Some>::expect<enum$<cranelift_codegen::isa::x64::inst::args::ExtMode>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\core\src\option.rs:351 4: cranelift_codegen::isa::x64::lower::extend_input_to_reg<cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>> at .\codegen\src\isa\x64\lower.rs:233 5: cranelift_codegen::isa::x64::lower::{{impl}}::lower_branch_group<cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>> at .\codegen\src\isa\x64\lower.rs:6843 6: cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>::lower_clif_branches<enum$<cranelift_codegen::isa::x64::inst::Inst>,cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\lower.rs:880 7: cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>::lower<enum$<cranelift_codegen::isa::x64::inst::Inst>,cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\lower.rs:955 8: cranelift_codegen::machinst::compile::compile<cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\compile.rs:30 9: cranelift_codegen::isa::x64::X64Backend::compile_vcode at .\codegen\src\isa\x64\mod.rs:51 10: cranelift_codegen::isa::x64::{{impl}}::compile_function at .\codegen\src\isa\x64\mod.rs:62 11: cranelift_codegen::context::Context::compile at .\codegen\src\context.rs:197 12: cranelift_filetests::function_runner::compile at .\filetests\src\function_runner.rs:286 13: cranelift_filetests::function_runner::SingleFunctionCompiler::compile at .\filetests\src\function_runner.rs:77 14: cranelift_filetests::test_run::{{impl}}::run at .\filetests\src\test_run.rs:61 15: cranelift_filetests::runone::run_one_test at .\filetests\src\runone.rs:188 16: cranelift_filetests::runone::run at .\filetests\src\runone.rs:132 17: cranelift_filetests::concurrent::worker_thread::{{closure}}::{{closure}} at .\filetests\src\concurrent.rs:150 18: std::panicking::try::do_call<closure-0,enum$<core::result::Result<core::time::Duration, anyhow::Error>>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panicking.rs:401 19: std::panicking::try::do_catch<std::panic::AssertUnwindSafe<closure-0>,tuple<>> 20: std::panicking::try<enum$<core::result::Result<core::time::Duration, anyhow::Error>>,closure-0> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panicking.rs:365 21: std::panic::catch_unwind<closure-0,enum$<core::result::Result<core::time::Duration, anyhow::Error>>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panic.rs:434 22: cranelift_filetests::concurrent::worker_thread::{{closure}} at .\filetests\src\concurrent.rs:150 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
afonso360 labeled issue #3100:
Hey, While working on implementing
br_table
's for the interpreter i found the following test case that crashes on the x64 backend. This test case passes on s390x and aarch64, and on x64 it only fails for the i64 data type, it passes on i32, i16 and i8's.
.clif
Test Casetest run target x86_64 machinst function %br_table_i64(i64) -> i64 { jt0 = jump_table [block1, block2, block2, block3] block0(v0: i64): br_table v0, block4, jt0 block1: v1 = iconst.i64 1 jump block5(v1) block2: v2 = iconst.i64 2 jump block5(v2) block3: v3 = iconst.i64 3 jump block5(v3) block4: v4 = iconst.i64 4 jump block5(v4) block5(v5: i64): v6 = iadd.i64 v0, v5 return v6 } ; run: %br_table_i64(0) == 1 ; run: %br_table_i64(1) == 3 ; run: %br_table_i64(2) == 4 ; run: %br_table_i64(3) == 6 ; run: %br_table_i64(4) == 8 ; run: %br_table_i64(5) == 9 ; run: %br_table_i64(6) == 10 ; run: %br_table_i64(-1) == 3
Expected Results
This test case to pass.
Actual Results
This crashes with the following error:
thread 'worker #0' panicked at 'invalid extension: 64 -> 32', cranelift\codegen\src\isa\x64\lower.rs:233:38 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\std\src\panicking.rs:515 1: core::panicking::panic_fmt at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\core\src\panicking.rs:92 2: core::option::expect_failed at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\core\src\option.rs:1243 3: enum$<core::option::Option<enum$<cranelift_codegen::isa::x64::inst::args::ExtMode>>, 0, 4, Some>::expect<enum$<cranelift_codegen::isa::x64::inst::args::ExtMode>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\core\src\option.rs:351 4: cranelift_codegen::isa::x64::lower::extend_input_to_reg<cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>> at .\codegen\src\isa\x64\lower.rs:233 5: cranelift_codegen::isa::x64::lower::{{impl}}::lower_branch_group<cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>> at .\codegen\src\isa\x64\lower.rs:6843 6: cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>::lower_clif_branches<enum$<cranelift_codegen::isa::x64::inst::Inst>,cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\lower.rs:880 7: cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>::lower<enum$<cranelift_codegen::isa::x64::inst::Inst>,cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\lower.rs:955 8: cranelift_codegen::machinst::compile::compile<cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\compile.rs:30 9: cranelift_codegen::isa::x64::X64Backend::compile_vcode at .\codegen\src\isa\x64\mod.rs:51 10: cranelift_codegen::isa::x64::{{impl}}::compile_function at .\codegen\src\isa\x64\mod.rs:62 11: cranelift_codegen::context::Context::compile at .\codegen\src\context.rs:197 12: cranelift_filetests::function_runner::compile at .\filetests\src\function_runner.rs:286 13: cranelift_filetests::function_runner::SingleFunctionCompiler::compile at .\filetests\src\function_runner.rs:77 14: cranelift_filetests::test_run::{{impl}}::run at .\filetests\src\test_run.rs:61 15: cranelift_filetests::runone::run_one_test at .\filetests\src\runone.rs:188 16: cranelift_filetests::runone::run at .\filetests\src\runone.rs:132 17: cranelift_filetests::concurrent::worker_thread::{{closure}}::{{closure}} at .\filetests\src\concurrent.rs:150 18: std::panicking::try::do_call<closure-0,enum$<core::result::Result<core::time::Duration, anyhow::Error>>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panicking.rs:401 19: std::panicking::try::do_catch<std::panic::AssertUnwindSafe<closure-0>,tuple<>> 20: std::panicking::try<enum$<core::result::Result<core::time::Duration, anyhow::Error>>,closure-0> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panicking.rs:365 21: std::panic::catch_unwind<closure-0,enum$<core::result::Result<core::time::Duration, anyhow::Error>>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panic.rs:434 22: cranelift_filetests::concurrent::worker_thread::{{closure}} at .\filetests\src\concurrent.rs:150 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
bjorn3 commented on issue #3100:
Can you update https://github.com/bytecodealliance/wasmtime/blob/ebbe3997251add0278cc2de9c18dc43a1895f580/cranelift/frontend/src/switch.rs#L279-L285 once it is implemented?
cfallin closed issue #3100:
Hey, While working on implementing
br_table
's for the interpreter i found the following test case that crashes on the x64 backend. This test case passes on s390x and aarch64, and on x64 it only fails for the i64 data type, it passes on i32, i16 and i8's.
.clif
Test Casetest run target x86_64 machinst function %br_table_i64(i64) -> i64 { jt0 = jump_table [block1, block2, block2, block3] block0(v0: i64): br_table v0, block4, jt0 block1: v1 = iconst.i64 1 jump block5(v1) block2: v2 = iconst.i64 2 jump block5(v2) block3: v3 = iconst.i64 3 jump block5(v3) block4: v4 = iconst.i64 4 jump block5(v4) block5(v5: i64): v6 = iadd.i64 v0, v5 return v6 } ; run: %br_table_i64(0) == 1 ; run: %br_table_i64(1) == 3 ; run: %br_table_i64(2) == 4 ; run: %br_table_i64(3) == 6 ; run: %br_table_i64(4) == 8 ; run: %br_table_i64(5) == 9 ; run: %br_table_i64(6) == 10 ; run: %br_table_i64(-1) == 3
Expected Results
This test case to pass.
Actual Results
This crashes with the following error:
thread 'worker #0' panicked at 'invalid extension: 64 -> 32', cranelift\codegen\src\isa\x64\lower.rs:233:38 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\std\src\panicking.rs:515 1: core::panicking::panic_fmt at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\core\src\panicking.rs:92 2: core::option::expect_failed at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\/library\core\src\option.rs:1243 3: enum$<core::option::Option<enum$<cranelift_codegen::isa::x64::inst::args::ExtMode>>, 0, 4, Some>::expect<enum$<cranelift_codegen::isa::x64::inst::args::ExtMode>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\core\src\option.rs:351 4: cranelift_codegen::isa::x64::lower::extend_input_to_reg<cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>> at .\codegen\src\isa\x64\lower.rs:233 5: cranelift_codegen::isa::x64::lower::{{impl}}::lower_branch_group<cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>> at .\codegen\src\isa\x64\lower.rs:6843 6: cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>::lower_clif_branches<enum$<cranelift_codegen::isa::x64::inst::Inst>,cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\lower.rs:880 7: cranelift_codegen::machinst::lower::Lower<enum$<cranelift_codegen::isa::x64::inst::Inst>>::lower<enum$<cranelift_codegen::isa::x64::inst::Inst>,cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\lower.rs:955 8: cranelift_codegen::machinst::compile::compile<cranelift_codegen::isa::x64::X64Backend> at .\codegen\src\machinst\compile.rs:30 9: cranelift_codegen::isa::x64::X64Backend::compile_vcode at .\codegen\src\isa\x64\mod.rs:51 10: cranelift_codegen::isa::x64::{{impl}}::compile_function at .\codegen\src\isa\x64\mod.rs:62 11: cranelift_codegen::context::Context::compile at .\codegen\src\context.rs:197 12: cranelift_filetests::function_runner::compile at .\filetests\src\function_runner.rs:286 13: cranelift_filetests::function_runner::SingleFunctionCompiler::compile at .\filetests\src\function_runner.rs:77 14: cranelift_filetests::test_run::{{impl}}::run at .\filetests\src\test_run.rs:61 15: cranelift_filetests::runone::run_one_test at .\filetests\src\runone.rs:188 16: cranelift_filetests::runone::run at .\filetests\src\runone.rs:132 17: cranelift_filetests::concurrent::worker_thread::{{closure}}::{{closure}} at .\filetests\src\concurrent.rs:150 18: std::panicking::try::do_call<closure-0,enum$<core::result::Result<core::time::Duration, anyhow::Error>>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panicking.rs:401 19: std::panicking::try::do_catch<std::panic::AssertUnwindSafe<closure-0>,tuple<>> 20: std::panicking::try<enum$<core::result::Result<core::time::Duration, anyhow::Error>>,closure-0> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panicking.rs:365 21: std::panic::catch_unwind<closure-0,enum$<core::result::Result<core::time::Duration, anyhow::Error>>> at /rustc/7c3872e6bfd555d2ad753ac1f871db3bd7f2a547\library\std\src\panic.rs:434 22: cranelift_filetests::concurrent::worker_thread::{{closure}} at .\filetests\src\concurrent.rs:150 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Last updated: Nov 22 2024 at 16:03 UTC