summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm-validator.h6
-rw-r--r--src/wasm.cpp6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h
index 49e2eb5d8..3d9693421 100644
--- a/src/wasm-validator.h
+++ b/src/wasm-validator.h
@@ -71,8 +71,10 @@ public:
} else {
if (breakTypes[name] == unreachable) {
breakTypes[name] = valueType;
- } else {
- shouldBeEqual(valueType, breakTypes[name], name.str, "breaks to same target must have same type (ignoring unreachable)");
+ } else if (valueType != unreachable) {
+ if (valueType != breakTypes[name]) {
+ breakTypes[name] = none; // a poison value that must not be consumed
+ }
}
}
}
diff --git a/src/wasm.cpp b/src/wasm.cpp
index 2157992e3..98268310a 100644
--- a/src/wasm.cpp
+++ b/src/wasm.cpp
@@ -33,7 +33,11 @@ struct BlockTypeSeeker : public PostWalker<BlockTypeSeeker, Visitor<BlockTypeSee
if (other == none) {
type = none;
} else if (other != unreachable) {
- type = other;
+ if (type == unreachable) {
+ type = other;
+ } else if (type != other) {
+ type = none; // poison value, we saw multiple types; this should not be consumed
+ }
}
}
}