diff options
author | Thomas Lively <tlively@google.com> | 2024-07-26 15:50:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-26 12:50:58 -0700 |
commit | f938154a44ae4dd2733537c5683ebe2eeb1989a2 (patch) | |
tree | af0f811ba2f89d237513532571900c0d74043ea7 /test/reduce | |
parent | 9cc1cb1ca66e89cbe7b7b5b52897f3bee3ee422c (diff) | |
download | binaryen-f938154a44ae4dd2733537c5683ebe2eeb1989a2.tar.gz binaryen-f938154a44ae4dd2733537c5683ebe2eeb1989a2.tar.bz2 binaryen-f938154a44ae4dd2733537c5683ebe2eeb1989a2.zip |
[wasm-reduce] Do not crash on non-func element segments (#6778)
Generalize the code for simplifying element segments to handle more than
just null and funcref elements.
Diffstat (limited to 'test/reduce')
-rw-r--r-- | test/reduce/memory_table.wast | 11 | ||||
-rw-r--r-- | test/reduce/memory_table.wast.txt | 14 |
2 files changed, 24 insertions, 1 deletions
diff --git a/test/reduce/memory_table.wast b/test/reduce/memory_table.wast index 9518f5968..25caecb9d 100644 --- a/test/reduce/memory_table.wast +++ b/test/reduce/memory_table.wast @@ -2,12 +2,16 @@ (type $i (func (result i32))) (memory $0 256 256) (table 481 481 funcref) + (table 354 354 i31ref) (elem (i32.const 0) $f0 $f0 $f1 $f2 $f0 $f3 $f0) + (elem (table 1) (i32.const 0) i31ref + (item (ref.i31 (i32.const 0))) (item (ref.i31 (i32.const 42))) (item (ref.i31 (i32.const 99)))) (data (i32.const 0) "p\0bflkj") (data (i32.const 10960) "1234hello") (export "f1" (func $f1)) (export "f2" (func $f2)) (export "f4" (func $f4)) + (export "f5" (func $f5)) (func $f0 (result i32) (i32.const 1234) ) @@ -27,5 +31,10 @@ (call_indirect (type $i) (i32.const 0)) ) ) + (func $f5 (result i32) + (i32.add + (i31.get_s (table.get 1 (i32.const 0))) + (i31.get_u (table.get 1 (i32.const 1))) + ) + ) ) - diff --git a/test/reduce/memory_table.wast.txt b/test/reduce/memory_table.wast.txt index e56809ade..ca2fde914 100644 --- a/test/reduce/memory_table.wast.txt +++ b/test/reduce/memory_table.wast.txt @@ -2,9 +2,16 @@ (type $0 (func (result i32))) (type $1 (func)) (memory $0 256 256) + (table $0 354 354 i31ref) + (elem $0 (table $0) (i32.const 0) i31ref (item (ref.i31 + (i32.const 0) + )) (item (ref.i31 + (i32.const 42) + ))) (export "f1" (func $0)) (export "f2" (func $1)) (export "f4" (func $2)) + (export "f5" (func $3)) (func $0 ) (func $1 (result i32) @@ -22,5 +29,12 @@ (i32.const 1234) ) ) + (func $3 (result i32) + (i31.get_u + (table.get $0 + (i32.const 1) + ) + ) + ) ) |