assemblyscript/tests/compiler/overflow.optimized.wast

189 lines
3.2 KiB
Plaintext
Raw Normal View History

2018-02-10 09:45:49 +01:00
(module
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $v (func))
2018-02-10 12:13:07 +01:00
(type $i (func (result i32)))
2018-02-10 12:20:19 +01:00
(type $iv (func (param i32)))
2018-02-10 09:45:49 +01:00
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $overflow/badByte (mut i32) (i32.const 255))
(global $overflow/anotherBadByte (mut i32) (i32.const 255))
(global $overflow/badIncrementer (mut i32) (i32.const 1))
2018-02-10 12:13:07 +01:00
(global $overflow/valueU8 (mut i32) (i32.const 0))
2018-02-10 09:45:49 +01:00
(memory $0 1)
(data (i32.const 4) "\0b\00\00\00o\00v\00e\00r\00f\00l\00o\00w\00.\00t\00s")
2018-02-10 09:45:49 +01:00
(export "memory" (memory $0))
(start $start)
(func $overflow/local (; 1 ;) (type $v)
(nop)
)
2018-02-10 12:13:07 +01:00
(func $overflow/loadU8FF (; 2 ;) (type $i) (result i32)
(i32.store8
(i32.const 0)
(i32.const 255)
)
(i32.load8_u
(i32.const 0)
)
)
2018-02-10 12:20:19 +01:00
(func $overflow/storeU8FFadd1 (; 3 ;) (type $iv) (param $0 i32)
(i32.store8
(i32.const 0)
(get_local $0)
)
(if
(i32.load8_u
(i32.const 0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
2018-02-10 12:20:19 +01:00
(i32.const 36)
(i32.const 2)
)
(unreachable)
)
)
)
(func $start (; 4 ;) (type $v)
2018-02-10 09:45:49 +01:00
(set_global $overflow/badByte
(i32.and
(i32.add
(get_global $overflow/badByte)
(i32.const 1)
)
(i32.const 255)
)
)
(if
(get_global $overflow/badByte)
(block
(call $abort
(i32.const 0)
(i32.const 4)
2018-02-10 09:59:22 +01:00
(i32.const 5)
2018-02-10 09:45:49 +01:00
(i32.const 0)
)
(unreachable)
)
)
(set_global $overflow/anotherBadByte
(i32.and
(i32.add
(get_global $overflow/anotherBadByte)
(get_global $overflow/badIncrementer)
)
(i32.const 255)
)
)
(if
(get_global $overflow/anotherBadByte)
(block
(call $abort
(i32.const 0)
(i32.const 4)
2018-02-10 09:59:22 +01:00
(i32.const 10)
2018-02-10 09:45:49 +01:00
(i32.const 0)
)
(unreachable)
)
)
(call $overflow/local)
2018-02-10 12:13:07 +01:00
(set_global $overflow/valueU8
(call $overflow/loadU8FF)
)
(set_global $overflow/valueU8
(i32.and
(i32.add
(get_global $overflow/valueU8)
(i32.const 1)
)
(i32.const 255)
)
)
(if
(get_global $overflow/valueU8)
(block
(call $abort
(i32.const 0)
(i32.const 4)
2018-02-10 12:13:07 +01:00
(i32.const 32)
(i32.const 0)
)
(unreachable)
)
)
2018-02-10 12:20:19 +01:00
(set_global $overflow/valueU8
(i32.const 255)
)
(call $overflow/storeU8FFadd1
(i32.and
(i32.add
(get_global $overflow/valueU8)
(i32.const 1)
)
(i32.const 255)
)
)
(i32.store8
(i32.const 0)
(i32.add
(get_global $overflow/valueU8)
(i32.const 1)
)
)
(if
(i32.load8_u
(i32.const 0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
2018-02-10 12:20:19 +01:00
(i32.const 43)
(i32.const 0)
)
(unreachable)
)
)
(set_global $overflow/valueU8
(i32.and
(i32.add
(get_global $overflow/valueU8)
(i32.const 1)
)
(i32.const 255)
)
)
(i32.store8
(i32.const 0)
(get_global $overflow/valueU8)
)
(if
(i32.load8_u
(i32.const 0)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
2018-02-10 12:20:19 +01:00
(i32.const 46)
(i32.const 0)
)
(unreachable)
)
)
(if
(get_global $overflow/valueU8)
(block
(call $abort
(i32.const 0)
(i32.const 4)
2018-02-10 12:20:19 +01:00
(i32.const 47)
(i32.const 0)
)
(unreachable)
)
)
2018-02-10 09:45:49 +01:00
)
)