diff options
author | Oliver Horn <ohorn@users.noreply.github.com> | 2019-03-04 04:25:10 +0100 |
---|---|---|
committer | Ben Smith <binjimin@gmail.com> | 2019-03-03 19:25:10 -0800 |
commit | f320e3c34b4fbcf7d2ed30e8aa9ee01e383b67d6 (patch) | |
tree | 484b33e980b5f54ca3d0ee4fbf18fce4cf311c87 | |
parent | 3cdce2e009f371d532db748227fac615eb661e64 (diff) | |
download | wabt-f320e3c34b4fbcf7d2ed30e8aa9ee01e383b67d6.tar.gz wabt-f320e3c34b4fbcf7d2ed30e8aa9ee01e383b67d6.tar.bz2 wabt-f320e3c34b4fbcf7d2ed30e8aa9ee01e383b67d6.zip |
wasm-objdump: fix f64 init expressions (#1029)
The `PrintInitExpr` function falsely treated f64 as a float instead of
a double.
The test case `global.txt` also contained the wrong output, namely
`0x0p+0` instead of `0x1p+2` for `(f64.const 4)`.
-rw-r--r-- | src/binary-reader-objdump.cc | 2 | ||||
-rw-r--r-- | test/dump/global.txt | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index 03c4df8d..d4d058d3 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -1218,7 +1218,7 @@ void BinaryReaderObjdump::PrintInitExpr(const InitExpr& expr) { break; case InitExprType::F64: { char buffer[WABT_MAX_DOUBLE_HEX]; - WriteFloatHex(buffer, sizeof(buffer), expr.value.f64); + WriteDoubleHex(buffer, sizeof(buffer), expr.value.f64); PrintDetails(" - init f64=%s\n", buffer); break; } diff --git a/test/dump/global.txt b/test/dump/global.txt index 156a1264..df1fa63c 100644 --- a/test/dump/global.txt +++ b/test/dump/global.txt @@ -115,7 +115,7 @@ Global[8]: - global[4] i32 mutable=0 - init i32=1 - global[5] i64 mutable=0 - init i64=2 - global[6] f32 mutable=0 - init f32=0x1.8p+1 - - global[7] f64 mutable=0 - init f64=0x0p+0 + - global[7] f64 mutable=0 - init f64=0x1p+2 - global[8] i32 mutable=0 - init global=0 - global[9] i64 mutable=0 - init global=1 - global[10] f32 mutable=0 - init global=2 |