diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | src/support/bits.cpp | 2 | ||||
-rw-r--r-- | src/wasm.h | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml index b98a0040d..61585c3f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6'] packages: ['cmake', 'nodejs', 'clang-3.6'] - - env: COMPILER_VERSION=3.6 COMPILER_FLAGS="-fsanitize=undefined -fno-sanitize-recover=shift,null,alignment,bool,bounds,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,object-size,return,returns-nonnull-attribute,unreachable,unsigned-integer-overflow,vla-bound,vptr -fsanitize-blacklist=`pwd`/ubsan.blacklist" + - env: COMPILER_VERSION=3.6 COMPILER_FLAGS="-fsanitize=undefined -fno-sanitize-recover=all -fsanitize-blacklist=`pwd`/ubsan.blacklist" compiler: clang addons: *clang36 diff --git a/src/support/bits.cpp b/src/support/bits.cpp index 3d03b100c..aa72201f4 100644 --- a/src/support/bits.cpp +++ b/src/support/bits.cpp @@ -68,7 +68,7 @@ int CountTrailingZeroes<uint32_t>(uint32_t v) { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 }; - return v ? (int)tbl[((uint32_t)((v & -(int32_t)v) * 0x077CB531U)) >> 27] : 32; + return v ? (int)tbl[((uint32_t)((v & -v) * 0x077CB531U)) >> 27] : 32; } template<> diff --git a/src/wasm.h b/src/wasm.h index f9d0cb129..fabc702c5 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -409,8 +409,8 @@ public: Literal add(const Literal& other) const { switch (type) { - case WasmType::i32: return Literal(i32 + other.i32); - case WasmType::i64: return Literal(i64 + other.i64); + case WasmType::i32: return Literal(uint32_t(i32) + uint32_t(other.i32)); + case WasmType::i64: return Literal(uint64_t(i64) + uint64_t(other.i64)); case WasmType::f32: return Literal(getf32() + other.getf32()); case WasmType::f64: return Literal(getf64() + other.getf64()); default: WASM_UNREACHABLE(); @@ -418,8 +418,8 @@ public: } Literal sub(const Literal& other) const { switch (type) { - case WasmType::i32: return Literal(i32 - other.i32); - case WasmType::i64: return Literal(i64 - other.i64); + case WasmType::i32: return Literal(uint32_t(i32) - uint32_t(other.i32)); + case WasmType::i64: return Literal(uint64_t(i64) - uint64_t(other.i64)); case WasmType::f32: return Literal(getf32() - other.getf32()); case WasmType::f64: return Literal(getf64() - other.getf64()); default: WASM_UNREACHABLE(); @@ -427,8 +427,8 @@ public: } Literal mul(const Literal& other) const { switch (type) { - case WasmType::i32: return Literal(i32 * other.i32); - case WasmType::i64: return Literal(i64 * other.i64); + case WasmType::i32: return Literal(uint32_t(i32) * uint32_t(other.i32)); + case WasmType::i64: return Literal(uint64_t(i64) * uint64_t(other.i64)); case WasmType::f32: return Literal(getf32() * other.getf32()); case WasmType::f64: return Literal(getf64() * other.getf64()); default: WASM_UNREACHABLE(); |