mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-14 14:45:40 +00:00
7c6d73d4d9
This also was a wrong-code bug (I think), but we can't yet write tests for those.
41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
use wasmer_llvm_backend_tests::{get_compiler, wat2wasm};
|
|
use wasmer_runtime::imports;
|
|
use wasmer_runtime_core::compile_with;
|
|
|
|
#[test]
|
|
fn crash_return_with_float_on_stack() {
|
|
const MODULE: &str = r#"
|
|
(module
|
|
(type (;0;) (func))
|
|
(type (;1;) (func (param f64) (result f64)))
|
|
(func $_start (type 0))
|
|
(func $fmod (type 1) (param f64) (result f64)
|
|
local.get 0
|
|
f64.const 0x0p+0 (;=0;)
|
|
f64.mul
|
|
return)
|
|
)
|
|
"#;
|
|
let wasm_binary = wat2wasm(MODULE.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = compile_with(&wasm_binary, &get_compiler()).unwrap();
|
|
module.instantiate(&imports! {}).unwrap();
|
|
}
|
|
|
|
#[test]
|
|
fn crash_select_with_mismatched_pending() {
|
|
const MODULE: &str = r#"
|
|
(module
|
|
(func (param f64)
|
|
f64.const 0x0p+0 (;=0;)
|
|
local.get 0
|
|
f64.add
|
|
f64.const 0x0p+0 (;=0;)
|
|
i32.const 0
|
|
select
|
|
drop))
|
|
"#;
|
|
let wasm_binary = wat2wasm(MODULE.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = compile_with(&wasm_binary, &get_compiler()).unwrap();
|
|
module.instantiate(&imports! {}).unwrap();
|
|
}
|