binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

Bad i64.const constant

Open wingo opened this issue 2 years ago • 1 comments

Consider test.wat:

$ cat /tmp/test.wat
(module
 (func $f (export "f") (result i64)
   (i64.const 0x8000_0000)))

There is a bug parsing the constant:

$ ~/src/binaryen/bin/wasm-as -o /tmp/test.wasm /tmp/test.wat
$ ~/src/v8/out/x64.release/d8 -e 'print(new WebAssembly.Instance(new WebAssembly.Module(read("/tmp/test.wasm", "binary"))).exports.f())'
32768

If I remove the _ then it does parse as expected.

wingo avatar Mar 30 '23 07:03 wingo

This should already work correctly in the new parser.

tlively avatar Mar 30 '23 17:03 tlively