diff options
author | Alon Zakai <azakai@google.com> | 2021-07-16 10:14:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-16 10:14:54 -0700 |
commit | 88af50278a9bd36ae19a54151c2a3cf7a6f90023 (patch) | |
tree | d9604e411c5a9ea2489410380be7a8492fbac194 /test | |
parent | 5600a54526d3ed3d4501dc4db800de423a1c3b8d (diff) | |
download | binaryen-88af50278a9bd36ae19a54151c2a3cf7a6f90023.tar.gz binaryen-88af50278a9bd36ae19a54151c2a3cf7a6f90023.tar.bz2 binaryen-88af50278a9bd36ae19a54151c2a3cf7a6f90023.zip |
[Wasm GC] Fix getSentType() of BrOn with an unreachable input (#3993)
Without this fix, DCE would end up calling getHeapType() on the unreachable
input, which hits an assertion as it has no heap type.
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/dce_all-features.txt | 6 | ||||
-rw-r--r-- | test/passes/dce_all-features.wast | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/passes/dce_all-features.txt b/test/passes/dce_all-features.txt index bc1e24951..779405c13 100644 --- a/test/passes/dce_all-features.txt +++ b/test/passes/dce_all-features.txt @@ -591,3 +591,9 @@ ) ) ) +(module + (type $none_=>_ref|any| (func (result (ref any)))) + (func $foo (result (ref any)) + (unreachable) + ) +) diff --git a/test/passes/dce_all-features.wast b/test/passes/dce_all-features.wast index 0f0416f66..95344be93 100644 --- a/test/passes/dce_all-features.wast +++ b/test/passes/dce_all-features.wast @@ -792,3 +792,18 @@ ) ) ) +(module + (func $foo (result (ref any)) + (block $label$1 (result (ref any)) + ;; this break has an unreachable input, and so it does not have a heap type + ;; there, and no heap type to send on the branch. this tests we do not hit + ;; the assertion in getHeapType() if we call that. + (br_on_non_null $label$1 + (block (result anyref) + (unreachable) + ) + ) + (unreachable) + ) + ) +) |