summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 374a97e19..7147f2c3d 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -760,7 +760,15 @@ void Binary::finalize() {
}
}
-void Select::finalize(Type type_) { type = type_; }
+void Select::finalize(Type type_) {
+ assert(ifTrue && ifFalse);
+ if (ifTrue->type == Type::unreachable || ifFalse->type == Type::unreachable ||
+ condition->type == Type::unreachable) {
+ type = Type::unreachable;
+ } else {
+ type = type_;
+ }
+}
void Select::finalize() {
assert(ifTrue && ifFalse);