From 328e08358d6dff907bfa173687c84e86ff9590e7 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Mon, 19 Jun 2017 13:24:57 +0300 Subject: [PATCH] wasm_conversions --- spec/src/fixtures.rs | 4 +++- src/interpreter/value.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/src/fixtures.rs b/spec/src/fixtures.rs index fdcc8b0..b74ac1a 100644 --- a/spec/src/fixtures.rs +++ b/spec/src/fixtures.rs @@ -26,7 +26,9 @@ run_test!("break-drop", wasm_break_drop); run_test!("call_indirect", wasm_call_indirect); run_test!("call", wasm_call); run_test!("comments", wasm_comments); -// TODO: run_test!("conversions", wasm_conversions); +// TODO: commented out until sNaN issue is resolved: +// https://github.com/NikVolf/parity-wasm/blob/b5aaf103cf28f1e36df832f4883f55043e67894b/src/interpreter/value.rs#L510 +// run_test!("conversions", wasm_conversions); // TODO: run_test!("custom_section", wasm_custom_section); run_test!("endianness", wasm_endianness); run_test!("f32_exports", wasm_exports); diff --git a/src/interpreter/value.rs b/src/interpreter/value.rs index 736407f..aa91d37 100644 --- a/src/interpreter/value.rs +++ b/src/interpreter/value.rs @@ -274,7 +274,9 @@ macro_rules! impl_try_truncate_into { return Err(Error::Value("invalid float value for this operation".into())); } - if self < $into::MIN as $from || self > $into::MAX as $from { + // range check + let result = self as $into; + if result as $from != self.trunc() { return Err(Error::Value("invalid float value for this operation".into())); }