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.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 7a4bb6a97..ba8712d35 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -3074,8 +3074,11 @@ static void validateBinaryenIR(Module& wasm, ValidationInfo& info) {
bool validControlFlowStructureChange =
Properties::isControlFlowStructure(curr) && oldType.isConcrete() &&
newType == Type::unreachable;
- if (!Type::isSubType(newType, oldType) &&
- !validControlFlowStructureChange) {
+ // It's ok in general for types to get refined as long as they don't
+ // become unreachable.
+ bool validRefinement =
+ Type::isSubType(newType, oldType) && newType != Type::unreachable;
+ if (!validRefinement && !validControlFlowStructureChange) {
std::ostringstream ss;
ss << "stale type found in " << scope << " on " << curr
<< "\n(marked as " << oldType << ", should be " << newType