summaryrefslogtreecommitdiff
path: root/test/lit/validation
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/validation')
-rw-r--r--test/lit/validation/array-init-data.wast27
-rw-r--r--test/lit/validation/array-new-data.wast25
2 files changed, 52 insertions, 0 deletions
diff --git a/test/lit/validation/array-init-data.wast b/test/lit/validation/array-init-data.wast
new file mode 100644
index 000000000..088d0e9de
--- /dev/null
+++ b/test/lit/validation/array-init-data.wast
@@ -0,0 +1,27 @@
+;; array.init_data refers to a data segment and therefore requires the datacount
+;; section be emitted (so it can be validated, per the spec, using only previous
+;; sections), which means bulk memory must be enabled.
+
+;; RUN: not wasm-opt --enable-reference-types --enable-gc %s 2>&1 | filecheck %s
+
+;; CHECK: Data segment operations require bulk memory
+
+(module
+ (type $0 (array i8))
+
+ (memory $0 16 17)
+
+ (data $0 (i32.const 0) "")
+
+ (func $0
+ (array.init_data $0 $0
+ (ref.null $0)
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+)
+
+;; But it passes with the feature enabled.
+;; RUN: wasm-opt --enable-reference-types --enable-gc --enable-bulk-memory %s
diff --git a/test/lit/validation/array-new-data.wast b/test/lit/validation/array-new-data.wast
new file mode 100644
index 000000000..e7d67ee34
--- /dev/null
+++ b/test/lit/validation/array-new-data.wast
@@ -0,0 +1,25 @@
+;; array.new_data refers to a data segment and therefore requires the datacount
+;; section be emitted (so it can be validated, per the spec, using only previous
+;; sections), which means bulk memory must be enabled.
+
+;; RUN: not wasm-opt --enable-reference-types --enable-gc %s 2>&1 | filecheck %s
+
+;; CHECK: Data segment operations require bulk memory
+
+(module
+ (type $0 (array i8))
+
+ (memory $0 16 17)
+
+ (data $0 (i32.const 0) "")
+
+ (func $0 (result (ref $0))
+ (array.new_data $0 $0
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+)
+
+;; But it passes with the feature enabled.
+;; RUN: wasm-opt --enable-reference-types --enable-gc --enable-bulk-memory %s