diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-05-08 14:12:39 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-05-08 14:12:39 -0700 |
commit | f6d5a9df297997af5165ff164cb1609fbc0239e6 (patch) | |
tree | 3aadad360c741ad461055255795bae4ed561e7bc /test/wasm_backend/i64_load.cpp | |
parent | da1b3b84f04113d5ea3b05f21dd30dca0e113ade (diff) | |
download | binaryen-f6d5a9df297997af5165ff164cb1609fbc0239e6.tar.gz binaryen-f6d5a9df297997af5165ff164cb1609fbc0239e6.tar.bz2 binaryen-f6d5a9df297997af5165ff164cb1609fbc0239e6.zip |
Be more careful when loading i64 in wasm-js glue, we had a bug where the bits were trampled before we read them (#460)
Diffstat (limited to 'test/wasm_backend/i64_load.cpp')
-rw-r--r-- | test/wasm_backend/i64_load.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/wasm_backend/i64_load.cpp b/test/wasm_backend/i64_load.cpp new file mode 100644 index 000000000..a54b31650 --- /dev/null +++ b/test/wasm_backend/i64_load.cpp @@ -0,0 +1,15 @@ +#include <stdint.h> +#include <stdio.h> + +struct S1 { unsigned lo:32; unsigned mid:2; unsigned hi:30; }; + +static struct S1 g_68 = { -1, 0, 0xbbe }; // 0xbbe = 3006 + +extern "C" void emscripten_autodebug_i32(int32_t x, int32_t y); + +int main() { + emscripten_autodebug_i32(0, g_68.lo); + emscripten_autodebug_i32(1, g_68.mid); + emscripten_autodebug_i32(2, g_68.hi); + return 0; +} |