From e3c38c14e7dd9c115da960daafd109d2687f1a08 Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Sun, 10 Jan 2016 10:49:59 -0800 Subject: 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. --- src/asm2wasm.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/asm2wasm.h') diff --git a/src/asm2wasm.h b/src/asm2wasm.h index db7cc1ae0..c72c7e98a 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -385,7 +385,7 @@ private: } if (ast[1] == MINUS && ast[2][0] == NUM) { double num = -ast[2][1]->getNumber(); - assert(isInteger32(num)); + assert(isSInteger32(num)); return Literal((int32_t)num); } if (ast[1] == PLUS && ast[2][0] == UNARY_PREFIX && ast[2][1] == MINUS && ast[2][2][0] == NUM) { @@ -912,9 +912,12 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { } else if (what == NUM) { auto ret = allocator.alloc(); double num = ast[1]->getNumber(); - if (isInteger32(num)) { + if (isSInteger32(num)) { ret->value.type = WasmType::i32; - ret->value.i32 = toInteger32(num); + ret->value.i32 = toSInteger32(num); + } else if (isUInteger32(num)) { + ret->value.type = WasmType::i32; + ret->value.i32 = toUInteger32(num); } else { ret->value.type = WasmType::f64; ret->value.f64 = num; -- cgit v1.2.3