summaryrefslogtreecommitdiff
path: root/src/wasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm')
-rw-r--r--src/wasm/wasm-validator.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 984c25b3f..d81297408 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -1917,9 +1917,10 @@ void FunctionValidator::visitTupleMake(TupleMake* curr) {
}
types.push_back(op->type);
}
- shouldBeTrue(Type(types) == curr->type,
- curr,
- "Type of tuple.make does not match types of its operands");
+ shouldBeSubType(Type(types),
+ curr->type,
+ curr,
+ "Type of tuple.make does not match types of its operands");
}
void FunctionValidator::visitTupleExtract(TupleExtract* curr) {
@@ -1929,13 +1930,15 @@ void FunctionValidator::visitTupleExtract(TupleExtract* curr) {
curr,
"If tuple.extract has an unreachable operand, it must be unreachable");
} else {
- shouldBeTrue(curr->index < curr->tuple->type.size(),
- curr,
- "tuple.extract index out of bounds");
- shouldBeTrue(
- curr->type == curr->tuple->type.expand()[curr->index],
- curr,
- "tuple.extract type does not match the type of the extracted element");
+ bool inBounds = curr->index < curr->tuple->type.size();
+ shouldBeTrue(inBounds, curr, "tuple.extract index out of bounds");
+ if (inBounds) {
+ shouldBeSubType(
+ curr->tuple->type.expand()[curr->index],
+ curr->type,
+ curr,
+ "tuple.extract type does not match the type of the extracted element");
+ }
}
}