summaryrefslogtreecommitdiff
path: root/src/wasm/literal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r--src/wasm/literal.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index a7c14fdb6..d309be308 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -139,7 +139,11 @@ Literals Literal::makeZero(Type type) {
Literal Literal::makeSingleZero(Type type) {
assert(type.isSingle());
if (type.isRef()) {
- return makeNull(type);
+ if (type == Type::i31ref) {
+ return makeI31(0);
+ } else {
+ return makeNull(type);
+ }
} else {
return makeFromInt32(0, type);
}
@@ -438,7 +442,7 @@ std::ostream& operator<<(std::ostream& o, Literal literal) {
o << "eqref(null)";
break;
case Type::i31ref:
- o << "i31ref(" << literal.geti31(false) << ")";
+ o << "i31ref(" << literal.geti31() << ")";
break;
case Type::unreachable:
WASM_UNREACHABLE("invalid type");