wa-lang.org/wazero@v1.0.2/internal/integration_test/spectest/v2/testdata/unreached-valid.wast (about)

     1  (module
     2  
     3    ;; Check that both sides of the select are evaluated
     4    (func (export "select-trap-left") (param $cond i32) (result i32)
     5      (select (unreachable) (i32.const 0) (local.get $cond))
     6    )
     7    (func (export "select-trap-right") (param $cond i32) (result i32)
     8      (select (i32.const 0) (unreachable) (local.get $cond))
     9    )
    10  
    11    (func (export "select-unreached")
    12      (unreachable) (select)
    13      (unreachable) (i32.const 0) (select)
    14      (unreachable) (i32.const 0) (i32.const 0) (select)
    15      (unreachable) (i32.const 0) (i32.const 0) (i32.const 0) (select)
    16      (unreachable) (f32.const 0) (i32.const 0) (select)
    17      (unreachable)
    18    )
    19  
    20    (func (export "select_unreached_result_1") (result i32)
    21      (unreachable) (i32.add (select))
    22    )
    23  
    24    (func (export "select_unreached_result_2") (result i64)
    25      (unreachable) (i64.add (select (i64.const 0) (i32.const 0)))
    26    )
    27  
    28    (func (export "unreachable-num")
    29      (unreachable)
    30      (select)
    31      (i32.eqz)
    32      (drop)
    33    )
    34    (func (export "unreachable-ref")
    35      (unreachable)
    36      (select)
    37      (ref.is_null)
    38      (drop)
    39    )
    40  )
    41  
    42  (assert_trap (invoke "select-trap-left" (i32.const 1)) "unreachable")
    43  (assert_trap (invoke "select-trap-left" (i32.const 0)) "unreachable")
    44  (assert_trap (invoke "select-trap-right" (i32.const 1)) "unreachable")
    45  (assert_trap (invoke "select-trap-right" (i32.const 0)) "unreachable")
    46  
    47  ;; Validation after unreachable
    48  
    49  (module
    50    (func (export "meet-bottom")
    51      (block (result f64)
    52        (block (result f32)
    53          (unreachable)
    54          (br_table 0 1 1 (i32.const 1))
    55        )
    56        (drop)
    57        (f64.const 0)
    58      )
    59      (drop)
    60    )
    61  )
    62  
    63  (assert_trap (invoke "meet-bottom") "unreachable")