summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai (kripken) <alonzakai@gmail.com>2017-07-11 14:18:52 -0700
committerAlon Zakai (kripken) <alonzakai@gmail.com>2017-07-13 11:54:03 -0700
commitcf6c4cff644b87b4c9688931e2924e2d73b9998f (patch)
treea067a43241633a931f9aa5252f384358256dc9d2 /test
parentb2c17a105e9fbe86c059793032ee0be676245a8a (diff)
downloadbinaryen-cf6c4cff644b87b4c9688931e2924e2d73b9998f.tar.gz
binaryen-cf6c4cff644b87b4c9688931e2924e2d73b9998f.tar.bz2
binaryen-cf6c4cff644b87b4c9688931e2924e2d73b9998f.zip
infinite loops have side effects
Diffstat (limited to 'test')
-rw-r--r--test/passes/remove-unused-brs_shrink-level=1.txt16
-rw-r--r--test/passes/remove-unused-brs_shrink-level=1.wast16
-rw-r--r--test/passes/remove-unused-names_vacuum.txt16
-rw-r--r--test/passes/remove-unused-names_vacuum.wast23
4 files changed, 64 insertions, 7 deletions
diff --git a/test/passes/remove-unused-brs_shrink-level=1.txt b/test/passes/remove-unused-brs_shrink-level=1.txt
index 09e727ea5..a26f4ebf4 100644
--- a/test/passes/remove-unused-brs_shrink-level=1.txt
+++ b/test/passes/remove-unused-brs_shrink-level=1.txt
@@ -123,4 +123,20 @@
)
)
)
+ (func $join-and-it-becomes-unreachable (type $1)
+ (block $label$1
+ (block $block
+ (br_if $label$1
+ (i32.load8_u
+ (i32.const -93487262)
+ )
+ )
+ (br_if $label$1
+ (loop $label$5
+ (br $label$5)
+ )
+ )
+ )
+ )
+ )
)
diff --git a/test/passes/remove-unused-brs_shrink-level=1.wast b/test/passes/remove-unused-brs_shrink-level=1.wast
index 000658b91..88977be9e 100644
--- a/test/passes/remove-unused-brs_shrink-level=1.wast
+++ b/test/passes/remove-unused-brs_shrink-level=1.wast
@@ -77,5 +77,21 @@
(br_if $out8 (call $b14)) ;; side effect
)
)
+ (func $join-and-it-becomes-unreachable
+ (block $label$1
+ (block
+ (br_if $label$1
+ (i32.load8_u
+ (i32.const -93487262)
+ )
+ )
+ (br_if $label$1
+ (loop $label$5 ;; this is unreachable (infinite loop, no exit)
+ (br $label$5)
+ )
+ )
+ )
+ )
+ )
)
diff --git a/test/passes/remove-unused-names_vacuum.txt b/test/passes/remove-unused-names_vacuum.txt
index 999d8915e..d27fb3d65 100644
--- a/test/passes/remove-unused-names_vacuum.txt
+++ b/test/passes/remove-unused-names_vacuum.txt
@@ -4,11 +4,15 @@
(memory $0 0)
(func $return-i32-but-body-is-unreachable3 (type $0) (result i32)
(local $label i32)
- (unreachable)
+ (loop $while-in$1
+ (br $while-in$1)
+ )
)
(func $return-i32-but-body-is-unreachable4 (type $0) (result i32)
(local $label i32)
- (unreachable)
+ (loop $while-in$1
+ (br $while-in$1)
+ )
)
(func $to-drop-unreachable (type $1)
(drop
@@ -17,4 +21,12 @@
)
)
)
+ (func $return-i32-but-body-is-unreachable5 (type $0) (result i32)
+ (local $label i32)
+ (unreachable)
+ )
+ (func $return-i32-but-body-is-unreachable6 (type $0) (result i32)
+ (local $label i32)
+ (unreachable)
+ )
)
diff --git a/test/passes/remove-unused-names_vacuum.wast b/test/passes/remove-unused-names_vacuum.wast
index f45f50274..66412353c 100644
--- a/test/passes/remove-unused-names_vacuum.wast
+++ b/test/passes/remove-unused-names_vacuum.wast
@@ -16,12 +16,25 @@
)
(i32.const 0)
)
- (func $to-drop-unreachable
- (drop
- (block (result i32)
- (unreachable)
+ (func $to-drop-unreachable
+ (drop
+ (block (result i32)
+ (unreachable)
+ )
)
)
- )
+ (func $return-i32-but-body-is-unreachable5 (result i32)
+ (local $label i32)
+ (block ;; without a name here, vaccum had a too-eager bug
+ (unreachable)
+ )
+ )
+ (func $return-i32-but-body-is-unreachable6 (result i32)
+ (local $label i32)
+ (block ;; without a name here, vaccum had a too-eager bug
+ (unreachable)
+ )
+ (i32.const 0)
+ )
)