summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-validator.cpp4
-rw-r--r--src/wasm/wasm.cpp2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 3baaacb16..a8bb4a536 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -2549,6 +2549,10 @@ void FunctionValidator::visitRefTest(RefTest* curr) {
curr->ref->type.isRef(), curr, "ref.test ref must have ref type")) {
return;
}
+ if (!shouldBeTrue(
+ curr->castType.isRef(), curr, "ref.test target must have ref type")) {
+ return;
+ }
shouldBeEqual(
curr->castType.getHeapType().getBottom(),
curr->ref->type.getHeapType().getBottom(),
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 52a09e90c..21dc6e25e 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -953,6 +953,8 @@ void RefTest::finalize() {
type = Type::unreachable;
} else {
type = Type::i32;
+ // Do not unnecessarily lose type information.
+ castType = Type::getGreatestLowerBound(castType, ref->type);
}
}