summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/post-emscripten.txt24
-rw-r--r--test/passes/post-emscripten.wast23
2 files changed, 46 insertions, 1 deletions
diff --git a/test/passes/post-emscripten.txt b/test/passes/post-emscripten.txt
index 13fb3e0de..7b8567cb1 100644
--- a/test/passes/post-emscripten.txt
+++ b/test/passes/post-emscripten.txt
@@ -152,3 +152,27 @@
(nop)
)
)
+(module
+ (type $none_=>_none (func))
+ (type $i32_i32_f32_=>_none (func (param i32 i32 f32)))
+ (type $i32_f32_=>_none (func (param i32 f32)))
+ (type $f64_f64_=>_f64 (func (param f64 f64) (result f64)))
+ (import "env" "glob" (global $glob i32))
+ (import "global.Math" "pow" (func $Math_pow (param f64 f64) (result f64)))
+ (import "env" "invoke_vif" (func $invoke_vif (param i32 i32 f32)))
+ (memory $0 256 256)
+ (table $0 7 7 funcref)
+ (elem (i32.const 0) $other_safe)
+ (func $exc (; 2 ;)
+ (call $invoke_vif
+ (i32.const 0)
+ (i32.const 42)
+ (f32.const 3.141590118408203)
+ )
+ )
+ (func $other_safe (; 3 ;) (param $0 i32) (param $1 f32)
+ (call_indirect (type $none_=>_none)
+ (i32.const 0)
+ )
+ )
+)
diff --git a/test/passes/post-emscripten.wast b/test/passes/post-emscripten.wast
index fe60858f7..e5a4637cc 100644
--- a/test/passes/post-emscripten.wast
+++ b/test/passes/post-emscripten.wast
@@ -109,7 +109,7 @@
(call $call)
)
)
-(module
+(module ;; non-constant base for elem
(type $0 (func (param i32)))
(import "global.Math" "pow" (func $Math_pow (param f64 f64) (result f64)))
(import "env" "invoke_vif" (func $invoke_vif (param i32 i32 f32)))
@@ -127,3 +127,24 @@
(func $other_safe (param i32) (param f32)
)
)
+(module ;; indirect call in the invoke target, which we assume might throw
+ (type $none_=>_none (func))
+ (import "global.Math" "pow" (func $Math_pow (param f64 f64) (result f64)))
+ (import "env" "invoke_vif" (func $invoke_vif (param i32 i32 f32)))
+ (import "env" "glob" (global $glob i32)) ;; non-constant table offset
+ (memory 256 256)
+ (table 7 7 funcref)
+ (elem (i32.const 0) $other_safe)
+ (func $exc
+ (call $invoke_vif
+ (i32.const 0) ;; other_safe()
+ (i32.const 42)
+ (f32.const 3.14159)
+ )
+ )
+ (func $other_safe (param i32) (param f32)
+ (call_indirect (type $none_=>_none)
+ (i32.const 0)
+ )
+ )
+)