Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

[stack-switching] Regression test (#14447)

Daniel Hillerströmd8ccdb96d337
diff --git a/tests/misc_testsuite/stack-switching/issue13298.wast b/tests/misc_testsuite/stack-switching/issue13298.wast
new file mode 100644
index 0000000000..d5135df844
--- /dev/null
+++ b/tests/misc_testsuite/stack-switching/issue13298.wast
@@ -0,0 +1,32 @@
+;;! bulk_memory = true
+;;! exceptions = true
+;;! function_references = true
+;;! stack_switching = true
+
+;; Regression test for
+;; https://github.com/bytecodealliance/wasmtime/issues/13298
+;;
+;; Stack-switching segfault due to missing updates to store stack
+;; extents during switches #13298
+
+(module
+ (type $ft (func))
+ (tag $t (type $ft))
+ (type $ct (cont $ft))
+
+ (func $callee (suspend $t))
+ (elem declare func $callee)
+
+ (func (export "go")
+ (local $k (ref null $ct))
+ (local.set $k (cont.new $ct (ref.func $callee)))
+ (block $h (result (ref null $ct))
+ (resume $ct (on $t $h) (local.get $k))
+ (unreachable)
+ )
+ (drop)
+ (unreachable)
+ )
+)
+
+(assert_trap (invoke "go") "unreachable")
\ No newline at end of file