-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
float tests fails on wasm32-unknown-emscripten #42630
Comments
Add a travis builder for wasm32-unknown-emscripten This commits add an entry to travis matrix that will execute wasm32-unknown-emscripten tests suites. - Emscripten for asmjs was updated to sdk-1.37.13-64bit - The tests are run with node 8.0.0 (it can execute wasm) - A wrapper script is used to run each test from the directory where it is (workaround for emscripten-core/emscripten#4542) - Some tests are ignore, see #42629 and #42630
Looks like one culprit is I managed to minimize example: use std::num::FpCategory as Fp;
fn repr2() -> Fp {
const EXP_MASK: u64 = 0x7ff0000000000000;
let man: u64 = 0;
let exp: u64 = 0x3FF0000000000000;
match (man, exp) {
(0, EXP_MASK) => Fp::Infinite,
(0, 0) => Fp::Zero,
_ => Fp::Normal,
}
}
fn main() {
let class = repr2();
assert_eq!(class, Fp::Normal);
} This passes on Outputs: https://gist.github.com/pepyakin/89e31cb565662b216a794875e6258da1 |
I finally figured it out. Let's consider further minified example: fn main() {
let x: u64 = 0;
match x {
0x7ff0000000000000 => panic!("1"),
0x7ff0000000000001 => panic!("2"),
_ => {}
};
} asmjs version of switch looks fine: switch (i64($0)) {
case i64_const(0,2146435072): {
__ZN3std9panicking15begin_panic_new17hd7ebc2b159ba3f26E(5257,1,3232); //@line 47 "main.rs"
// unreachable; //@line 47 "main.rs"
break;
}
case i64_const(1,2146435072): {
__ZN3std9panicking15begin_panic_new17hd7ebc2b159ba3f26E(5256,1,3248); //@line 48 "main.rs"
// unreachable; //@line 48 "main.rs"
break;
} Then let's look on wasm output produced for this asmjs (only first arm
If I get it right,
|
Test fn main() {
let x64: f64 = 2.2250738585072014e-308;
let a: String = format!("{:?}", x64);
let b: String = "0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072014".into();
assert_eq!(a, b);
} |
It seems that test |
This is great @pepyakin! Thanks for tracking this! |
WebAssembly/binaryen#1111 is merged. |
Closing due to upstream fix merged, yay! |
Re-enable num tests on wasm Issue rust-lang#42630 was closed but the tests are still ignored, supposedly they should pass now.
This tests (taken from rust tests):
fails on
wasm32-unknown-emscripten
. I think that this as bug in asm2wasm because the same tests works onasmjs-unknown-emscripten
. I used cross to run the tests (it is necessary to create a project and put the code in lib.rs):Tests results:
The text was updated successfully, but these errors were encountered: