diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 5b1163ae0..0dfcf5c2e 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -959,9 +959,17 @@ Type BrOn::getSentType() { // BrOnNull does not send a value on the branch. return Type::none; case BrOnNonNull: + // If the input is unreachable, the branch is not taken, and there is no + // valid type we can report as being sent. Report it as unreachable. + if (ref->type == Type::unreachable) { + return Type::unreachable; + } // BrOnNonNull sends the non-nullable type on the branch. return Type(ref->type.getHeapType(), NonNullable); case BrOnCast: + if (ref->type == Type::unreachable) { + return Type::unreachable; + } return Type(rtt->type.getHeapType(), NonNullable); case BrOnFunc: return Type::funcref; |