summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ctor-eval/bad-indirect-call3.wast16
-rw-r--r--test/ctor-eval/bad-indirect-call3.wast.ctors1
-rw-r--r--test/ctor-eval/bad-indirect-call3.wast.out22
-rw-r--r--test/spec/call_indirect_sig_mismatch.wast14
4 files changed, 53 insertions, 0 deletions
diff --git a/test/ctor-eval/bad-indirect-call3.wast b/test/ctor-eval/bad-indirect-call3.wast
new file mode 100644
index 000000000..cadff8097
--- /dev/null
+++ b/test/ctor-eval/bad-indirect-call3.wast
@@ -0,0 +1,16 @@
+(module
+ (type $funcref_=>_none (func (param funcref)))
+ (memory 256 256)
+ (data (i32.const 10) "waka waka waka waka waka")
+ (table funcref (elem $callee))
+ (export "sig_mismatch" (func $sig_mismatch))
+ (func $callee (param $0 exnref)
+ (i32.store8 (i32.const 40) (i32.const 67))
+ )
+ (func $sig_mismatch
+ (call_indirect (type $funcref_=>_none) ;; unsafe to call, signature mismatch
+ (ref.null)
+ (i32.const 0)
+ )
+ )
+)
diff --git a/test/ctor-eval/bad-indirect-call3.wast.ctors b/test/ctor-eval/bad-indirect-call3.wast.ctors
new file mode 100644
index 000000000..363ce3a3c
--- /dev/null
+++ b/test/ctor-eval/bad-indirect-call3.wast.ctors
@@ -0,0 +1 @@
+sig_mismatch
diff --git a/test/ctor-eval/bad-indirect-call3.wast.out b/test/ctor-eval/bad-indirect-call3.wast.out
new file mode 100644
index 000000000..ec1d2adf6
--- /dev/null
+++ b/test/ctor-eval/bad-indirect-call3.wast.out
@@ -0,0 +1,22 @@
+(module
+ (type $none_=>_none (func))
+ (type $funcref_=>_none (func (param funcref)))
+ (type $exnref_=>_none (func (param exnref)))
+ (memory $0 256 256)
+ (data (i32.const 10) "waka waka waka waka waka")
+ (table $0 1 1 funcref)
+ (elem (i32.const 0) $callee)
+ (export "sig_mismatch" (func $sig_mismatch))
+ (func $callee (; 0 ;) (param $0 exnref)
+ (i32.store8
+ (i32.const 40)
+ (i32.const 67)
+ )
+ )
+ (func $sig_mismatch (; 1 ;)
+ (call_indirect (type $funcref_=>_none)
+ (ref.null)
+ (i32.const 0)
+ )
+ )
+)
diff --git a/test/spec/call_indirect_sig_mismatch.wast b/test/spec/call_indirect_sig_mismatch.wast
new file mode 100644
index 000000000..15e5d6a5a
--- /dev/null
+++ b/test/spec/call_indirect_sig_mismatch.wast
@@ -0,0 +1,14 @@
+(module
+ (type $funcref_=>_none (func (param funcref)))
+ (table funcref (elem $callee))
+ (export "sig_mismatch" (func $sig_mismatch))
+ (func $callee (param $0 exnref))
+ (func $sig_mismatch
+ (call_indirect (type $funcref_=>_none)
+ (ref.null)
+ (i32.const 0)
+ )
+ )
+)
+
+(assert_trap (invoke "sig_mismatch") "callIndirect: function signatures don't match")