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.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 4c30a4e32..b17250e6c 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -1223,7 +1223,13 @@ void ArrayInitElem::finalize() {
}
void RefAs::finalize() {
- if (value->type == Type::unreachable) {
+ // An unreachable child means we are unreachable. Also set ourselves to
+ // unreachable when the child is invalid (say, it is an i32 or some other non-
+ // reference), which avoids getHeapType() erroring right after us (in this
+ // situation, the validator will report an error later).
+ // TODO: Remove that part when we solve the validation issue more generally,
+ // see https://github.com/WebAssembly/binaryen/issues/6781
+ if (!value->type.isRef()) {
type = Type::unreachable;
return;
}