-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathlinking0.wast
More file actions
42 lines (37 loc) · 1.02 KB
/
linking0.wast
File metadata and controls
42 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(module $Mt
(type (func (result i32)))
(type (func))
(table (export "tab") 10 funcref)
(elem (i32.const 2) $g $g $g $g)
(func $g (result i32) (i32.const 4))
(func (export "h") (result i32) (i32.const -4))
(func (export "call") (param i32) (result i32)
(call_indirect (type 0) (local.get 0))
)
)
(register "Mt" $Mt)
(assert_unlinkable
(module
(table (import "Mt" "tab") 10 funcref)
(memory (import "spectest" "memory") 1)
(memory (import "Mt" "mem") 1) ;; does not exist
(func $f (result i32) (i32.const 0))
(elem (i32.const 7) $f)
(elem (i32.const 9) $f)
)
"unknown import"
)
(assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized element")
(assert_trap
(module
(table (import "Mt" "tab") 10 funcref)
(func $f (result i32) (i32.const 0))
(elem (i32.const 7) $f)
(memory 0)
(memory $m 1)
(memory 0)
(data $m (i32.const 0x10000) "d") ;; out of bounds
)
"out of bounds memory access"
)
(assert_return (invoke $Mt "call" (i32.const 7)) (i32.const 0))