summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-09-01 09:59:04 -0700
committerGitHub <noreply@github.com>2018-09-01 09:59:04 -0700
commita852156980986d6c5875981a49c16fe8b98875c3 (patch)
tree40d254794757b82197c8bc3530ce9973e2daf3b1 /src/tools
parent9750c18faba7be48f9e086fd2d00838ca4ae9d0f (diff)
downloadbinaryen-a852156980986d6c5875981a49c16fe8b98875c3.tar.gz
binaryen-a852156980986d6c5875981a49c16fe8b98875c3.tar.bz2
binaryen-a852156980986d6c5875981a49c16fe8b98875c3.zip
Change the Literal class's operator== to be bitwise (#1661)
The change means that nan values will be compared bitwise when writing A == B, and so the float rule of a nan is different from itself would not apply. I think this is a safer default. In particular this PR fixes a fuzz bug in the rse pass, which placed Literals in a hash table, and due to nan != nan, an infinite loop... Also, looks like we really want a bitwise comparison pretty much everywhere anyhow, as can be seen in the diff here. Really the single place we need a floaty comparison is in the intepreter where we implement f32.eq etc., and there the code was already using the proper code path anyhow.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/execution-results.h2
-rw-r--r--src/tools/wasm-shell.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h
index fe82c024a..1e8fba4ff 100644
--- a/src/tools/execution-results.h
+++ b/src/tools/execution-results.h
@@ -78,7 +78,7 @@ struct ExecutionResults {
abort();
}
std::cout << "[fuzz-exec] comparing " << name << '\n';
- if (!results[name].bitwiseEqual(other.results[name])) {
+ if (results[name] != other.results[name]) {
std::cout << "not identical!\n";
abort();
}
diff --git a/src/tools/wasm-shell.cpp b/src/tools/wasm-shell.cpp
index 613fc8040..2a59be167 100644
--- a/src/tools/wasm-shell.cpp
+++ b/src/tools/wasm-shell.cpp
@@ -201,14 +201,14 @@ static void run_asserts(Name moduleName, size_t* i, bool* checked, Module* wasm,
->dynCast<Const>()
->value;
std::cerr << "seen " << result << ", expected " << expected << '\n';
- if (!expected.bitwiseEqual(result)) {
+ if (expected != result) {
std::cout << "unexpected, should be identical\n";
abort();
}
} else {
Literal expected;
std::cerr << "seen " << result << ", expected " << expected << '\n';
- if (!expected.bitwiseEqual(result)) {
+ if (expected != result) {
std::cout << "unexpected, should be identical\n";
abort();
}