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.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 74e9b6e79..e8a4033ef 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -1004,9 +1004,11 @@ void FunctionValidator::visitGlobalGet(GlobalGet* curr) {
if (!info.validateGlobally) {
return;
}
- shouldBeTrue(getModule()->getGlobalOrNull(curr->name),
- curr,
- "global.get name must be valid");
+ auto* global = getModule()->getGlobalOrNull(curr->name);
+ if (shouldBeTrue(global, curr, "global.get name must be valid")) {
+ shouldBeEqual(
+ curr->type, global->type, curr, "global.get must have right type");
+ }
}
void FunctionValidator::visitGlobalSet(GlobalSet* curr) {