diff options
author | Alon Zakai <azakai@google.com> | 2021-09-15 12:28:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 12:28:58 -0700 |
commit | 1ec93d2ed521431ffea3152759a5b693e085d7a1 (patch) | |
tree | 85f499ceefd3ce8dab40e17598467bcc5fb8a02b /src | |
parent | e61393d27b031435d11160f3f91e1e8b8583c0c0 (diff) | |
download | binaryen-1ec93d2ed521431ffea3152759a5b693e085d7a1.tar.gz binaryen-1ec93d2ed521431ffea3152759a5b693e085d7a1.tar.bz2 binaryen-1ec93d2ed521431ffea3152759a5b693e085d7a1.zip |
[Wasm GC] Fix OptimizeInstructions on unreachable ref.test (#4156)
Avoids a crash in calling getHeapType when there isn't one.
Also add the relevant lit test (and a few others) to the list of files to
fuzz more heavily.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 217312501..e48eecb72 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -1450,6 +1450,10 @@ struct OptimizeInstructions } void visitRefTest(RefTest* curr) { + if (curr->type == Type::unreachable) { + return; + } + // See above in RefCast. if (!canBeCastTo(curr->ref->type.getHeapType(), curr->rtt->type.getHeapType())) { |