summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2016-01-10 10:49:59 -0800
committerJF Bastien <jfb@chromium.org>2016-01-10 17:40:15 -0800
commite3c38c14e7dd9c115da960daafd109d2687f1a08 (patch)
treec8e892eed8ad9dc0a5e071b9e8af775733dedc03 /src/wasm.h
parent75a562190a9f4588c8ffb19b8304f76c15a850c6 (diff)
downloadbinaryen-e3c38c14e7dd9c115da960daafd109d2687f1a08.tar.gz
binaryen-e3c38c14e7dd9c115da960daafd109d2687f1a08.tar.bz2
binaryen-e3c38c14e7dd9c115da960daafd109d2687f1a08.zip
Add Travis builds with sanitizers
This triggers 5 independent build / test runs: - clang, no sanitizer; - clang, UB sanitizer; - clang, address sanitizer (disabled for now); - clang, thread sanitizer (disabled for now); - GCC. Enabling UBSan led to these changes: - Fix a bunch of undefined behavior throughout the code base. - Fix some tests that relied on that undefined behavior. - Make some of the tests easier to debug by printing their command line. - Add ubsan blacklist to work around libstdc++ bug. - Example testcase also needs sanitizer because libsupport.a uses it.
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wasm.h b/src/wasm.h
index b1b8d84d4..c4654580a 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -45,13 +45,14 @@
#define wasm_wasm_h
#include <cassert>
+#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <fstream>
#include <map>
-#include <vector>
#include <string>
+#include <vector>
#include "compiler-support.h"
#include "emscripten-optimizer/simple_ast.h"
@@ -200,7 +201,7 @@ struct Literal {
}
static void printDouble(std::ostream &o, double d) {
- if (d == 0 && 1/d < 0) {
+ if (d == 0 && std::signbit(d)) {
o << "-0";
return;
}