summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2022-04-05 08:37:21 -0700
committerGitHub <noreply@github.com>2022-04-05 08:37:21 -0700
commit291698fe1b5512d72186dfc2400bca85dcb507b1 (patch)
treecf5b9ac5833d4bd6286e60b8df0dbcafc25aeec5 /test
parent18c969e74f14670e52cc9f74c4e76ff197af3f36 (diff)
downloadbinaryen-291698fe1b5512d72186dfc2400bca85dcb507b1.tar.gz
binaryen-291698fe1b5512d72186dfc2400bca85dcb507b1.tar.bz2
binaryen-291698fe1b5512d72186dfc2400bca85dcb507b1.zip
Fix MemoryPacking bug (#4579)
247f4c20a1 introduced a bug that caused expressions that refer to data segments to be associated with the wrong segments in the presence of other segments that have no referring expressions at all. Fixes #4569. Fixes #4571.
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/memory-packing_all-features.wast26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/lit/passes/memory-packing_all-features.wast b/test/lit/passes/memory-packing_all-features.wast
index 5fbf92023..6bee38ca0 100644
--- a/test/lit/passes/memory-packing_all-features.wast
+++ b/test/lit/passes/memory-packing_all-features.wast
@@ -2270,4 +2270,30 @@
(data (i32.const 1024) "x")
(data (i32.const 2048) "\00")
)
+
;; CHECK: (data (i32.const 1024) "x")
+(module
+ ;; Regression test for a bug where referrers were accidentally associated with
+ ;; the wrong segments in the presence of unreferenced segments.
+ ;; CHECK: (type $none_=>_none (func))
+
+ ;; CHECK: (memory $0 (shared 1 1))
+ (memory $0 (shared 1 1))
+ (data (i32.const 0) "")
+ ;; CHECK: (data "foo")
+ (data "foo")
+ ;; CHECK: (func $0
+ ;; CHECK-NEXT: (memory.init 0
+ ;; CHECK-NEXT: (i32.const 0)
+ ;; CHECK-NEXT: (i32.const 1)
+ ;; CHECK-NEXT: (i32.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $0
+ (memory.init 1
+ (i32.const 0)
+ (i32.const 1)
+ (i32.const 1)
+ )
+ )
+)