summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ctor-eval/stack-direction.wast30
-rw-r--r--test/ctor-eval/stack-direction.wast.ctors1
-rw-r--r--test/ctor-eval/stack-direction.wast.out2
3 files changed, 33 insertions, 0 deletions
diff --git a/test/ctor-eval/stack-direction.wast b/test/ctor-eval/stack-direction.wast
new file mode 100644
index 000000000..ebd6ef3fc
--- /dev/null
+++ b/test/ctor-eval/stack-direction.wast
@@ -0,0 +1,30 @@
+(module
+ (type $0 (func))
+ (import "env" "memory" (memory $1 256 256))
+ (import "env" "STACKTOP" (global $gimport$0 i32))
+ (global $global$0 (mut i32) (get_global $gimport$0))
+ (export "__post_instantiate" (func $0))
+ ;; if the stack goes **down**, this may seem to write to memory we care about
+ (func $0 (; 0 ;) (type $0)
+ (local $0 i32)
+ (i32.store offset=12
+ (tee_local $0
+ (i32.sub
+ (get_global $global$0)
+ (i32.const 16)
+ )
+ )
+ (i32.const 10)
+ )
+ (i32.store offset=12
+ (get_local $0)
+ (i32.add
+ (i32.load offset=12
+ (get_local $0)
+ )
+ (i32.const 1)
+ )
+ )
+ )
+)
+
diff --git a/test/ctor-eval/stack-direction.wast.ctors b/test/ctor-eval/stack-direction.wast.ctors
new file mode 100644
index 000000000..a9d301395
--- /dev/null
+++ b/test/ctor-eval/stack-direction.wast.ctors
@@ -0,0 +1 @@
+__post_instantiate
diff --git a/test/ctor-eval/stack-direction.wast.out b/test/ctor-eval/stack-direction.wast.out
new file mode 100644
index 000000000..4427f36e0
--- /dev/null
+++ b/test/ctor-eval/stack-direction.wast.out
@@ -0,0 +1,2 @@
+(module
+)