summaryrefslogtreecommitdiff
path: root/test/passes/simplify-locals.wast
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-05-01 16:10:38 -0700
committerGitHub <noreply@github.com>2018-05-01 16:10:38 -0700
commitdba8e94c423d555086f8233935558c0853835e64 (patch)
tree8d77a11f884bd4ed38b5091b082dd7d7c2905e2b /test/passes/simplify-locals.wast
parent16d3174db2f3b8c56600633156f9765bc3ad96b1 (diff)
downloadbinaryen-dba8e94c423d555086f8233935558c0853835e64.tar.gz
binaryen-dba8e94c423d555086f8233935558c0853835e64.tar.bz2
binaryen-dba8e94c423d555086f8233935558c0853835e64.zip
Fix some fuzz bugs (#1528)
* remove-unused-brs: handle an if declared as returning a value despite having an unreachable condition * simplify-locals: don't work on loops while the main pass is making changes, as set_locals are being tracked and modified.
Diffstat (limited to 'test/passes/simplify-locals.wast')
-rw-r--r--test/passes/simplify-locals.wast32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/passes/simplify-locals.wast b/test/passes/simplify-locals.wast
index 28f584f83..3d82fe0a4 100644
--- a/test/passes/simplify-locals.wast
+++ b/test/passes/simplify-locals.wast
@@ -1097,4 +1097,36 @@
)
(get_local $x)
)
+ (func $loop-modified-during-main-pass-be-careful-fuzz (result i32)
+ (local $0 i32)
+ (if
+ (i32.const 0)
+ (set_local $0
+ (i32.const 0)
+ )
+ (loop $label$4
+ (br $label$4)
+ )
+ )
+ (get_local $0)
+ )
+ (func $loop-later (param $var$0 i32) (param $var$1 i32) (param $var$2 i32) (param $var$3 i32) (param $var$4 i32) (result i32)
+ (loop $label$1
+ (block $label$2
+ (if
+ (i32.const 0)
+ (block
+ (set_local $var$0
+ (i32.const -1)
+ )
+ (br $label$2)
+ )
+ )
+ (set_local $var$0
+ (i32.const -1)
+ )
+ )
+ )
+ (i32.const 0)
+ )
)