diff options
author | Alon Zakai <azakai@google.com> | 2021-06-08 18:56:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-08 18:56:10 -0700 |
commit | cdc1bb3406f40bdab918749d020e0ef03942434d (patch) | |
tree | c8ac8e03bc1939282bd164e4869f73269aaad3ac /test | |
parent | eac90b56d4a749f10d440e4bb7fd744e4bc756e8 (diff) | |
download | binaryen-cdc1bb3406f40bdab918749d020e0ef03942434d.tar.gz binaryen-cdc1bb3406f40bdab918749d020e0ef03942434d.tar.bz2 binaryen-cdc1bb3406f40bdab918749d020e0ef03942434d.zip |
[Wasm GC] Properly validate BrOn* (#3928)
The noteBreak call was in the wrong place, causing us to not note breaks
from BrOnNull for example, which could make validation miss errors.
Noticed in #3926
Diffstat (limited to 'test')
-rw-r--r-- | test/spec/br_on_null.wast | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/spec/br_on_null.wast b/test/spec/br_on_null.wast index 04b9f41db..8e0a8591f 100644 --- a/test/spec/br_on_null.wast +++ b/test/spec/br_on_null.wast @@ -40,3 +40,19 @@ (func (param $r (ref func)) (drop (br_on_null 0 (local.get $r)))) (func (param $r (ref extern)) (drop (br_on_null 0 (local.get $r)))) ) + +(assert_invalid + ;; the same module as the first one in this file, but with a type added to + ;; the block + (module + (type $t (func (result i32))) + + (func $nn (param $r (ref $t)) (result i32) + (block $l (ref null $t) ;; br_on_null sends no value; a br to here is bad + (return (call_ref (br_on_null $l (local.get $r)))) + ) + (i32.const -1) + ) + ) + "bad break type" +) |