diff options
author | Alon Zakai <azakai@google.com> | 2024-10-07 13:43:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-07 20:43:08 +0000 |
commit | bcdedab9a97dbea1c2ee151ca1013e3896f16c8a (patch) | |
tree | cfc99561a85a40379711d96ab5612269197681cf /test/lit/passes | |
parent | 0be8d5e07e5f893705bc36c5d09676ee65d3466f (diff) | |
download | binaryen-bcdedab9a97dbea1c2ee151ca1013e3896f16c8a.tar.gz binaryen-bcdedab9a97dbea1c2ee151ca1013e3896f16c8a.tar.bz2 binaryen-bcdedab9a97dbea1c2ee151ca1013e3896f16c8a.zip |
Fix a fuzz issue with #6984 (#6988)
When I refactored the optimizeDroppedBlock logic in #6982, I didn't move the
unreachability check with that code, which was wrong. When that function
was called from another place in #6984, the fuzzer found an issue.
Diff without whitespace is smaller. This reverts almost all the test updates
from #6984 - those changes were on blocks with unreachable children.
The change was safe on them, but in general removing a block value in the
presence of unreachable code is tricky, so it's best to avoid it.
The testcase is a little bizarre, but it's the one the fuzzer found and I can't
find a way to generate a better one (other than to reduce it, which I did).
Diffstat (limited to 'test/lit/passes')
-rw-r--r-- | test/lit/passes/merge-blocks.wast | 9 | ||||
-rw-r--r-- | test/lit/passes/monomorphize-drop.wast | 7 |
2 files changed, 11 insertions, 5 deletions
diff --git a/test/lit/passes/merge-blocks.wast b/test/lit/passes/merge-blocks.wast index 86181f7a4..6fa1687b8 100644 --- a/test/lit/passes/merge-blocks.wast +++ b/test/lit/passes/merge-blocks.wast @@ -405,11 +405,12 @@ ) ;; CHECK: (func $toplevel (type $4) - ;; CHECK-NEXT: (block $label - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block $label (result i32) + ;; CHECK-NEXT: (br $label + ;; CHECK-NEXT: (i32.const 42) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (br $label) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $toplevel diff --git a/test/lit/passes/monomorphize-drop.wast b/test/lit/passes/monomorphize-drop.wast index 2c6834204..a9f0e1f06 100644 --- a/test/lit/passes/monomorphize-drop.wast +++ b/test/lit/passes/monomorphize-drop.wast @@ -672,7 +672,12 @@ ;; CAREFUL: (func $return-normal_4 (type $1) ;; CAREFUL-NEXT: (drop -;; CAREFUL-NEXT: (call $import) +;; CAREFUL-NEXT: (block +;; CAREFUL-NEXT: (drop +;; CAREFUL-NEXT: (call $import) +;; CAREFUL-NEXT: ) +;; CAREFUL-NEXT: (return) +;; CAREFUL-NEXT: ) ;; CAREFUL-NEXT: ) ;; CAREFUL-NEXT: ) |