summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 4881ea7ac..f77eeefe7 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -606,9 +606,13 @@ private:
Type(Type::unreachable),
printable,
"return_call* should have unreachable type");
+ auto* func = getFunction();
+ if (!shouldBeTrue(!!func, curr, "function not defined")) {
+ return;
+ }
shouldBeSubType(
sig.results,
- getFunction()->getResults(),
+ func->getResults(),
printable,
"return_call* callee return type must match caller return type");
} else {
@@ -696,7 +700,12 @@ void FunctionValidator::visitBlock(Block* curr) {
}
breakTypes.erase(iter);
}
- switch (getFunction()->profile) {
+
+ auto* func = getFunction();
+ if (!shouldBeTrue(!!func, curr, "function not defined")) {
+ return;
+ }
+ switch (func->profile) {
case IRProfile::Normal:
validateNormalBlockElements(curr);
break;