summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.txt52
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.wast30
2 files changed, 82 insertions, 0 deletions
diff --git a/test/passes/Oz_fuzz-exec_all-features.txt b/test/passes/Oz_fuzz-exec_all-features.txt
index 48c9ecb5e..60d593b45 100644
--- a/test/passes/Oz_fuzz-exec_all-features.txt
+++ b/test/passes/Oz_fuzz-exec_all-features.txt
@@ -25,6 +25,13 @@
[LoggingExternalInterface logging 0]
[fuzz-exec] calling br_on_data
[LoggingExternalInterface logging 1]
+[fuzz-exec] calling $rtt-and-cast-on-func
+[LoggingExternalInterface logging 0]
+[LoggingExternalInterface logging 1]
+[LoggingExternalInterface logging 2]
+[LoggingExternalInterface logging 1337]
+[LoggingExternalInterface logging 3]
+[trap cast error]
(module
(type ${mut:i32} (struct (field (mut i32))))
(type $none_=>_none (func))
@@ -32,6 +39,7 @@
(type $[mut:i8] (array (mut i8)))
(type $i32_=>_none (func (param i32)))
(type $anyref_=>_none (func (param anyref)))
+ (type $none_=>_i32 (func (result i32)))
(import "fuzzing-support" "log-i32" (func $log (param i32)))
(export "structs" (func $0))
(export "arrays" (func $1))
@@ -39,6 +47,7 @@
(export "br_on_cast" (func $3))
(export "cast-null-anyref-to-gc" (func $4))
(export "br_on_data" (func $5))
+ (export "$rtt-and-cast-on-func" (func $7))
(func $0 (; has Stack IR ;)
(local $0 (ref null ${mut:i32}))
(call $log
@@ -187,6 +196,42 @@
)
)
)
+ (func $a-void-func (; has Stack IR ;)
+ (call $log
+ (i32.const 1337)
+ )
+ )
+ (func $7 (; has Stack IR ;)
+ (call $log
+ (i32.const 0)
+ )
+ (call $log
+ (i32.const 1)
+ )
+ (call $log
+ (i32.const 2)
+ )
+ (call_ref
+ (ref.cast $none_=>_none
+ (ref.func $a-void-func)
+ (rtt.canon $none_=>_none)
+ )
+ )
+ (call $log
+ (i32.const 3)
+ )
+ (drop
+ (call_ref
+ (ref.cast $none_=>_i32
+ (ref.func $a-void-func)
+ (rtt.canon $none_=>_i32)
+ )
+ )
+ )
+ (call $log
+ (i32.const 4)
+ )
+ )
)
[fuzz-exec] calling structs
[LoggingExternalInterface logging 0]
@@ -215,3 +260,10 @@
[LoggingExternalInterface logging 0]
[fuzz-exec] calling br_on_data
[LoggingExternalInterface logging 1]
+[fuzz-exec] calling $rtt-and-cast-on-func
+[LoggingExternalInterface logging 0]
+[LoggingExternalInterface logging 1]
+[LoggingExternalInterface logging 2]
+[LoggingExternalInterface logging 1337]
+[LoggingExternalInterface logging 3]
+[trap cast error]
diff --git a/test/passes/Oz_fuzz-exec_all-features.wast b/test/passes/Oz_fuzz-exec_all-features.wast
index a33f02fb5..44ea8625b 100644
--- a/test/passes/Oz_fuzz-exec_all-features.wast
+++ b/test/passes/Oz_fuzz-exec_all-features.wast
@@ -2,7 +2,12 @@
(type $struct (struct (mut i32)))
(type $extendedstruct (struct i32 f64))
(type $bytes (array (mut i8)))
+
+ (type $void_func (func))
+ (type $int_func (func (result i32)))
+
(import "fuzzing-support" "log-i32" (func $log (param i32)))
+
(func "structs"
(local $x (ref null $struct))
(local $y (ref null $struct))
@@ -196,4 +201,29 @@
)
)
)
+ (func $a-void-func
+ (call $log (i32.const 1337))
+ )
+ (func "$rtt-and-cast-on-func"
+ (call $log (i32.const 0))
+ (drop
+ (rtt.canon $void_func)
+ )
+ (call $log (i32.const 1))
+ (drop
+ (rtt.canon $int_func)
+ )
+ (call $log (i32.const 2))
+ ;; a valid cast
+ (call_ref
+ (ref.cast $void_func (ref.func $a-void-func) (rtt.canon $void_func))
+ )
+ (call $log (i32.const 3))
+ ;; an invalid cast
+ (drop (call_ref
+ (ref.cast $int_func (ref.func $a-void-func) (rtt.canon $int_func))
+ ))
+ ;; will never be reached
+ (call $log (i32.const 4))
+ )
)