diff options
author | Alon Zakai <azakai@google.com> | 2020-01-24 11:28:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-24 11:28:18 -0800 |
commit | 1a0530da9c0217e7118965aeb4ee1f59f68df73c (patch) | |
tree | a20d1d84a9fd0b5d12a7ae4de76a02559a1005dc /test/passes/post-emscripten.wast | |
parent | 1ca6394d34c827904e6ececb6463ef4899c95fe9 (diff) | |
download | binaryen-1a0530da9c0217e7118965aeb4ee1f59f68df73c.tar.gz binaryen-1a0530da9c0217e7118965aeb4ee1f59f68df73c.tar.bz2 binaryen-1a0530da9c0217e7118965aeb4ee1f59f68df73c.zip |
Handle indirect calls in CallGraphPropertyAnalysis (#2624)
We ignored them, which is a bad default, as typically they imply
we can call anything in the table (and the table might change).
Instead, notice indirect calls during traversal, and force the user
to decide whether to ignore them or not.
This was only an issue in PostEmscripten because the other
user, Asyncify, already had indirect call analysis because it
needed it for other things.
Fixes a bug uncovered by #2619 and fixes the current binaryen
roll.
Diffstat (limited to 'test/passes/post-emscripten.wast')
-rw-r--r-- | test/passes/post-emscripten.wast | 23 |
1 files changed, 22 insertions, 1 deletions
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) + ) + ) +) |