github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/integration_test/spectest/v1/testdata/block.wast (about)

     1  ;; Test `block` operator
     2  
     3  (module
     4    ;; Auxiliary definition
     5    (memory 1)
     6  
     7    (func $dummy)
     8  
     9    (func (export "empty")
    10      (block)
    11      (block $l)
    12    )
    13  
    14    (func (export "singular") (result i32)
    15      (block (nop))
    16      (block (result i32) (i32.const 7))
    17    )
    18  
    19    (func (export "multi") (result i32)
    20      (block (call $dummy) (call $dummy) (call $dummy) (call $dummy))
    21      (block (result i32) (call $dummy) (call $dummy) (call $dummy) (i32.const 8))
    22    )
    23  
    24    (func (export "nested") (result i32)
    25      (block (result i32)
    26        (block (call $dummy) (block) (nop))
    27        (block (result i32) (call $dummy) (i32.const 9))
    28      )
    29    )
    30  
    31    (func (export "deep") (result i32)
    32      (block (result i32) (block (result i32)
    33        (block (result i32) (block (result i32)
    34          (block (result i32) (block (result i32)
    35            (block (result i32) (block (result i32)
    36              (block (result i32) (block (result i32)
    37                (block (result i32) (block (result i32)
    38                  (block (result i32) (block (result i32)
    39                    (block (result i32) (block (result i32)
    40                      (block (result i32) (block (result i32)
    41                        (block (result i32) (block (result i32)
    42                          (block (result i32) (block (result i32)
    43                            (block (result i32) (block (result i32)
    44                              (block (result i32) (block (result i32)
    45                                (block (result i32) (block (result i32)
    46                                  (block (result i32) (block (result i32)
    47                                    (block (result i32) (block (result i32)
    48                                      (block (result i32) (block (result i32)
    49                                        (block (result i32) (block (result i32)
    50                                          (block (result i32) (block (result i32)
    51                                            (call $dummy) (i32.const 150)
    52                                          ))
    53                                        ))
    54                                      ))
    55                                    ))
    56                                  ))
    57                                ))
    58                              ))
    59                            ))
    60                          ))
    61                        ))
    62                      ))
    63                    ))
    64                  ))
    65                ))
    66              ))
    67            ))
    68          ))
    69        ))
    70      ))
    71    )
    72  
    73    (func (export "as-select-first") (result i32)
    74      (select (block (result i32) (i32.const 1)) (i32.const 2) (i32.const 3))
    75    )
    76    (func (export "as-select-mid") (result i32)
    77      (select (i32.const 2) (block (result i32) (i32.const 1)) (i32.const 3))
    78    )
    79    (func (export "as-select-last") (result i32)
    80      (select (i32.const 2) (i32.const 3) (block (result i32) (i32.const 1)))
    81    )
    82  
    83    (func (export "as-loop-first") (result i32)
    84      (loop (result i32) (block (result i32) (i32.const 1)) (call $dummy) (call $dummy))
    85    )
    86    (func (export "as-loop-mid") (result i32)
    87      (loop (result i32) (call $dummy) (block (result i32) (i32.const 1)) (call $dummy))
    88    )
    89    (func (export "as-loop-last") (result i32)
    90      (loop (result i32) (call $dummy) (call $dummy) (block (result i32) (i32.const 1)))
    91    )
    92  
    93    (func (export "as-if-condition")
    94      (block (result i32) (i32.const 1)) (if (then (call $dummy)))
    95    )
    96    (func (export "as-if-then") (result i32)
    97      (if (result i32) (i32.const 1) (then (block (result i32) (i32.const 1))) (else (i32.const 2)))
    98    )
    99    (func (export "as-if-else") (result i32)
   100      (if (result i32) (i32.const 1) (then (i32.const 2)) (else (block (result i32) (i32.const 1))))
   101    )
   102  
   103    (func (export "as-br_if-first") (result i32)
   104      (block (result i32) (br_if 0 (block (result i32) (i32.const 1)) (i32.const 2)))
   105    )
   106    (func (export "as-br_if-last") (result i32)
   107      (block (result i32) (br_if 0 (i32.const 2) (block (result i32) (i32.const 1))))
   108    )
   109  
   110    (func (export "as-br_table-first") (result i32)
   111      (block (result i32) (block (result i32) (i32.const 1)) (i32.const 2) (br_table 0 0))
   112    )
   113    (func (export "as-br_table-last") (result i32)
   114      (block (result i32) (i32.const 2) (block (result i32) (i32.const 1)) (br_table 0 0))
   115    )
   116  
   117    (func $func (param i32 i32) (result i32) (local.get 0))
   118    (type $check (func (param i32 i32) (result i32)))
   119    (table funcref (elem $func))
   120    (func (export "as-call_indirect-first") (result i32)
   121      (block (result i32)
   122        (call_indirect (type $check)
   123          (block (result i32) (i32.const 1)) (i32.const 2) (i32.const 0)
   124        )
   125      )
   126    )
   127    (func (export "as-call_indirect-mid") (result i32)
   128      (block (result i32)
   129        (call_indirect (type $check)
   130          (i32.const 2) (block (result i32) (i32.const 1)) (i32.const 0)
   131        )
   132      )
   133    )
   134    (func (export "as-call_indirect-last") (result i32)
   135      (block (result i32)
   136        (call_indirect (type $check)
   137          (i32.const 1) (i32.const 2) (block (result i32) (i32.const 0))
   138        )
   139      )
   140    )
   141  
   142    (func (export "as-store-first")
   143      (block (result i32) (i32.const 1)) (i32.const 1) (i32.store)
   144    )
   145    (func (export "as-store-last")
   146      (i32.const 10) (block (result i32) (i32.const 1)) (i32.store)
   147    )
   148  
   149    (func (export "as-memory.grow-value") (result i32)
   150      (memory.grow (block (result i32) (i32.const 1)))
   151    )
   152  
   153    (func $f (param i32) (result i32) (local.get 0))
   154  
   155    (func (export "as-call-value") (result i32)
   156      (call $f (block (result i32) (i32.const 1)))
   157    )
   158    (func (export "as-return-value") (result i32)
   159      (block (result i32) (i32.const 1)) (return)
   160    )
   161    (func (export "as-drop-operand")
   162      (drop (block (result i32) (i32.const 1)))
   163    )
   164    (func (export "as-br-value") (result i32)
   165      (block (result i32) (br 0 (block (result i32) (i32.const 1))))
   166    )
   167    (func (export "as-local.set-value") (result i32)
   168      (local i32) (local.set 0 (block (result i32) (i32.const 1))) (local.get 0)
   169    )
   170    (func (export "as-local.tee-value") (result i32)
   171      (local i32) (local.tee 0 (block (result i32) (i32.const 1)))
   172    )
   173    (global $a (mut i32) (i32.const 10))
   174    (func (export "as-global.set-value") (result i32)
   175      (global.set $a (block (result i32) (i32.const 1)))
   176      (global.get $a)
   177    )
   178  
   179    (func (export "as-load-operand") (result i32)
   180      (i32.load (block (result i32) (i32.const 1)))
   181    )
   182  
   183    (func (export "as-unary-operand") (result i32)
   184      (i32.ctz (block (result i32) (call $dummy) (i32.const 13)))
   185    )
   186    (func (export "as-binary-operand") (result i32)
   187      (i32.mul
   188        (block (result i32) (call $dummy) (i32.const 3))
   189        (block (result i32) (call $dummy) (i32.const 4))
   190      )
   191    )
   192    (func (export "as-test-operand") (result i32)
   193      (i32.eqz (block (result i32) (call $dummy) (i32.const 13)))
   194    )
   195    (func (export "as-compare-operand") (result i32)
   196      (f32.gt
   197        (block (result f32) (call $dummy) (f32.const 3))
   198        (block (result f32) (call $dummy) (f32.const 3))
   199      )
   200    )
   201  
   202    (func (export "break-bare") (result i32)
   203      (block (br 0) (unreachable))
   204      (block (br_if 0 (i32.const 1)) (unreachable))
   205      (block (br_table 0 (i32.const 0)) (unreachable))
   206      (block (br_table 0 0 0 (i32.const 1)) (unreachable))
   207      (i32.const 19)
   208    )
   209    (func (export "break-value") (result i32)
   210      (block (result i32) (br 0 (i32.const 18)) (i32.const 19))
   211    )
   212    (func (export "break-repeated") (result i32)
   213      (block (result i32)
   214        (br 0 (i32.const 18))
   215        (br 0 (i32.const 19))
   216        (drop (br_if 0 (i32.const 20) (i32.const 0)))
   217        (drop (br_if 0 (i32.const 20) (i32.const 1)))
   218        (br 0 (i32.const 21))
   219        (br_table 0 (i32.const 22) (i32.const 4))
   220        (br_table 0 0 0 (i32.const 23) (i32.const 1))
   221        (i32.const 21)
   222      )
   223    )
   224    (func (export "break-inner") (result i32)
   225      (local i32)
   226      (local.set 0 (i32.const 0))
   227      (local.set 0 (i32.add (local.get 0) (block (result i32) (block (result i32) (br 1 (i32.const 0x1))))))
   228      (local.set 0 (i32.add (local.get 0) (block (result i32) (block (br 0)) (i32.const 0x2))))
   229      (local.set 0
   230        (i32.add (local.get 0) (block (result i32) (i32.ctz (br 0 (i32.const 0x4)))))
   231      )
   232      (local.set 0
   233        (i32.add (local.get 0) (block (result i32) (i32.ctz (block (result i32) (br 1 (i32.const 0x8))))))
   234      )
   235      (local.get 0)
   236    )
   237  
   238    (func (export "effects") (result i32)
   239      (local i32)
   240      (block
   241        (local.set 0 (i32.const 1))
   242        (local.set 0 (i32.mul (local.get 0) (i32.const 3)))
   243        (local.set 0 (i32.sub (local.get 0) (i32.const 5)))
   244        (local.set 0 (i32.mul (local.get 0) (i32.const 7)))
   245        (br 0)
   246        (local.set 0 (i32.mul (local.get 0) (i32.const 100)))
   247      )
   248      (i32.eq (local.get 0) (i32.const -14))
   249    )
   250  )
   251  
   252  (assert_return (invoke "empty"))
   253  (assert_return (invoke "singular") (i32.const 7))
   254  (assert_return (invoke "multi") (i32.const 8))
   255  (assert_return (invoke "nested") (i32.const 9))
   256  (assert_return (invoke "deep") (i32.const 150))
   257  
   258  (assert_return (invoke "as-select-first") (i32.const 1))
   259  (assert_return (invoke "as-select-mid") (i32.const 2))
   260  (assert_return (invoke "as-select-last") (i32.const 2))
   261  
   262  (assert_return (invoke "as-loop-first") (i32.const 1))
   263  (assert_return (invoke "as-loop-mid") (i32.const 1))
   264  (assert_return (invoke "as-loop-last") (i32.const 1))
   265  
   266  (assert_return (invoke "as-if-condition"))
   267  (assert_return (invoke "as-if-then") (i32.const 1))
   268  (assert_return (invoke "as-if-else") (i32.const 2))
   269  
   270  (assert_return (invoke "as-br_if-first") (i32.const 1))
   271  (assert_return (invoke "as-br_if-last") (i32.const 2))
   272  
   273  (assert_return (invoke "as-br_table-first") (i32.const 1))
   274  (assert_return (invoke "as-br_table-last") (i32.const 2))
   275  
   276  (assert_return (invoke "as-call_indirect-first") (i32.const 1))
   277  (assert_return (invoke "as-call_indirect-mid") (i32.const 2))
   278  (assert_return (invoke "as-call_indirect-last") (i32.const 1))
   279  
   280  (assert_return (invoke "as-store-first"))
   281  (assert_return (invoke "as-store-last"))
   282  
   283  (assert_return (invoke "as-memory.grow-value") (i32.const 1))
   284  (assert_return (invoke "as-call-value") (i32.const 1))
   285  (assert_return (invoke "as-return-value") (i32.const 1))
   286  (assert_return (invoke "as-drop-operand"))
   287  (assert_return (invoke "as-br-value") (i32.const 1))
   288  (assert_return (invoke "as-local.set-value") (i32.const 1))
   289  (assert_return (invoke "as-local.tee-value") (i32.const 1))
   290  (assert_return (invoke "as-global.set-value") (i32.const 1))
   291  (assert_return (invoke "as-load-operand") (i32.const 1))
   292  
   293  (assert_return (invoke "as-unary-operand") (i32.const 0))
   294  (assert_return (invoke "as-binary-operand") (i32.const 12))
   295  (assert_return (invoke "as-test-operand") (i32.const 0))
   296  (assert_return (invoke "as-compare-operand") (i32.const 0))
   297  
   298  (assert_return (invoke "break-bare") (i32.const 19))
   299  (assert_return (invoke "break-value") (i32.const 18))
   300  (assert_return (invoke "break-repeated") (i32.const 18))
   301  (assert_return (invoke "break-inner") (i32.const 0xf))
   302  
   303  (assert_return (invoke "effects") (i32.const 1))
   304  
   305  (assert_invalid
   306    (module (func $type-empty-i32 (result i32) (block)))
   307    "type mismatch"
   308  )
   309  (assert_invalid
   310    (module (func $type-empty-i64 (result i64) (block)))
   311    "type mismatch"
   312  )
   313  (assert_invalid
   314    (module (func $type-empty-f32 (result f32) (block)))
   315    "type mismatch"
   316  )
   317  (assert_invalid
   318    (module (func $type-empty-f64 (result f64) (block)))
   319    "type mismatch"
   320  )
   321  
   322  (assert_invalid
   323    (module (func $type-value-i32-vs-void
   324      (block (i32.const 1))
   325    ))
   326    "type mismatch"
   327  )
   328  (assert_invalid
   329    (module (func $type-value-i64-vs-void
   330      (block (i64.const 1))
   331    ))
   332    "type mismatch"
   333  )
   334  (assert_invalid
   335    (module (func $type-value-f32-vs-void
   336      (block (f32.const 1.0))
   337    ))
   338    "type mismatch"
   339  )
   340  (assert_invalid
   341    (module (func $type-value-f64-vs-void
   342      (block (f64.const 1.0))
   343    ))
   344    "type mismatch"
   345  )
   346  
   347  (assert_invalid
   348    (module (func $type-value-empty-vs-i32 (result i32)
   349      (block (result i32))
   350    ))
   351    "type mismatch"
   352  )
   353  (assert_invalid
   354    (module (func $type-value-empty-vs-i64 (result i64)
   355      (block (result i64))
   356    ))
   357    "type mismatch"
   358  )
   359  (assert_invalid
   360    (module (func $type-value-empty-vs-f32 (result f32)
   361      (block (result f32))
   362    ))
   363    "type mismatch"
   364  )
   365  (assert_invalid
   366    (module (func $type-value-empty-vs-f64 (result f64)
   367      (block (result f64))
   368    ))
   369    "type mismatch"
   370  )
   371  
   372  (assert_invalid
   373    (module
   374      (func $type-value-empty-in-block
   375        (i32.const 0)
   376        (block (block (result i32)) (drop))
   377      )
   378    )
   379    "type mismatch"
   380  )
   381  (assert_invalid
   382    (module
   383      (func $type-value-empty-in-loop
   384        (i32.const 0)
   385        (loop (block (result i32)) (drop))
   386      )
   387    )
   388    "type mismatch"
   389  )
   390  (assert_invalid
   391    (module
   392      (func $type-value-empty-in-then
   393        (i32.const 0) (i32.const 0)
   394        (if (then (block (result i32)) (drop)))
   395      )
   396    )
   397    "type mismatch"
   398  )
   399  
   400  (assert_invalid
   401    (module (func $type-value-void-vs-i32 (result i32)
   402      (block (result i32) (nop))
   403    ))
   404    "type mismatch"
   405  )
   406  (assert_invalid
   407    (module (func $type-value-void-vs-i64 (result i64)
   408      (block (result i64) (nop))
   409    ))
   410    "type mismatch"
   411  )
   412  (assert_invalid
   413    (module (func $type-value-void-vs-f32 (result f32)
   414      (block (result f32) (nop))
   415    ))
   416    "type mismatch"
   417  )
   418  (assert_invalid
   419    (module (func $type-value-void-vs-f64 (result f64)
   420      (block (result f64) (nop))
   421    ))
   422    "type mismatch"
   423  )
   424  
   425  (assert_invalid
   426    (module (func $type-value-i32-vs-i64 (result i32)
   427      (block (result i32) (i64.const 0))
   428    ))
   429    "type mismatch"
   430  )
   431  (assert_invalid
   432    (module (func $type-value-i32-vs-f32 (result i32)
   433      (block (result i32) (f32.const 0.0))
   434    ))
   435    "type mismatch"
   436  )
   437  (assert_invalid
   438    (module (func $type-value-i32-vs-f64 (result i32)
   439      (block (result i32) (f64.const 0.0))
   440    ))
   441    "type mismatch"
   442  )
   443  (assert_invalid
   444    (module (func $type-value-i64-vs-i32 (result i64)
   445      (block (result i64) (i32.const 0))
   446    ))
   447    "type mismatch"
   448  )
   449  (assert_invalid
   450    (module (func $type-value-i64-vs-f32 (result i64)
   451      (block (result i64) (f32.const 0.0))
   452    ))
   453    "type mismatch"
   454  )
   455  (assert_invalid
   456    (module (func $type-value-i64-vs-f64 (result i64)
   457      (block (result i64) (f64.const 0.0))
   458    ))
   459    "type mismatch"
   460  )
   461  (assert_invalid
   462    (module (func $type-value-f32-vs-i32 (result f32)
   463      (block (result f32) (i32.const 0))
   464    ))
   465    "type mismatch"
   466  )
   467  (assert_invalid
   468    (module (func $type-value-f32-vs-i64 (result f32)
   469      (block (result f32) (i64.const 0))
   470    ))
   471    "type mismatch"
   472  )
   473  (assert_invalid
   474    (module (func $type-value-f32-vs-f64 (result f32)
   475      (block (result f32) (f64.const 0.0))
   476    ))
   477    "type mismatch"
   478  )
   479  (assert_invalid
   480    (module (func $type-value-f64-vs-i32 (result f64)
   481      (block (result f64) (i32.const 0))
   482    ))
   483    "type mismatch"
   484  )
   485  (assert_invalid
   486    (module (func $type-value-f64-vs-i64 (result f64)
   487      (block (result f64) (i64.const 0))
   488    ))
   489    "type mismatch"
   490  )
   491  (assert_invalid
   492    (module (func $type-value-f64-vs-f32 (result f32)
   493      (block (result f64) (f32.const 0.0))
   494    ))
   495    "type mismatch"
   496  )
   497  
   498  (assert_invalid
   499    (module (func $type-value-unreached-select-i32-i64 (result i32)
   500      (block (result i64) (select (unreachable) (unreachable) (unreachable)))
   501    ))
   502    "type mismatch"
   503  )
   504  (assert_invalid
   505    (module (func $type-value-unreached-select-i32-f32 (result i32)
   506      (block (result f32) (select (unreachable) (unreachable) (unreachable)))
   507    ))
   508    "type mismatch"
   509  )
   510  (assert_invalid
   511    (module (func $type-value-unreached-select-i32-f64 (result i32)
   512      (block (result f64) (select (unreachable) (unreachable) (unreachable)))
   513    ))
   514    "type mismatch"
   515  )
   516  (assert_invalid
   517    (module (func $type-value-unreached-select-i64-i32 (result i64)
   518      (block (result i32) (select (unreachable) (unreachable) (unreachable)))
   519    ))
   520    "type mismatch"
   521  )
   522  (assert_invalid
   523    (module (func $type-value-unreached-select-i64-f32 (result i64)
   524      (block (result f32) (select (unreachable) (unreachable) (unreachable)))
   525    ))
   526    "type mismatch"
   527  )
   528  (assert_invalid
   529    (module (func $type-value-unreached-select-i64-f64 (result i64)
   530      (block (result f64) (select (unreachable) (unreachable) (unreachable)))
   531    ))
   532    "type mismatch"
   533  )
   534  (assert_invalid
   535    (module (func $type-value-unreached-select-f32-i32 (result f32)
   536      (block (result i32) (select (unreachable) (unreachable) (unreachable)))
   537    ))
   538    "type mismatch"
   539  )
   540  (assert_invalid
   541    (module (func $type-value-unreached-select-f32-i64 (result f32)
   542      (block (result i64) (select (unreachable) (unreachable) (unreachable)))
   543    ))
   544    "type mismatch"
   545  )
   546  (assert_invalid
   547    (module (func $type-value-unreached-select-f32-f64 (result f32)
   548      (block (result f64) (select (unreachable) (unreachable) (unreachable)))
   549    ))
   550    "type mismatch"
   551  )
   552  (assert_invalid
   553    (module (func $type-value-unreached-select-f64-i32 (result f64)
   554      (block (result i32) (select (unreachable) (unreachable) (unreachable)))
   555    ))
   556    "type mismatch"
   557  )
   558  (assert_invalid
   559    (module (func $type-value-unreached-select-f64-i64 (result f64)
   560      (block (result i64) (select (unreachable) (unreachable) (unreachable)))
   561    ))
   562    "type mismatch"
   563  )
   564  (assert_invalid
   565    (module (func $type-value-unreached-select-f64-f32 (result f64)
   566      (block (result f32) (select (unreachable) (unreachable) (unreachable)))
   567    ))
   568    "type mismatch"
   569  )
   570  
   571  (assert_invalid
   572    (module (func $type-break-last-void-vs-i32 (result i32)
   573      (block (result i32) (br 0))
   574    ))
   575    "type mismatch"
   576  )
   577  (assert_invalid
   578    (module (func $type-break-last-void-vs-i64 (result i64)
   579      (block (result i64) (br 0))
   580    ))
   581    "type mismatch"
   582  )
   583  (assert_invalid
   584    (module (func $type-break-last-void-vs-f32 (result f32)
   585      (block (result f32) (br 0))
   586    ))
   587    "type mismatch"
   588  )
   589  (assert_invalid
   590    (module (func $type-break-last-void-vs-f64 (result f64)
   591      (block (result f64) (br 0))
   592    ))
   593    "type mismatch"
   594  )
   595  
   596  (assert_invalid
   597    (module (func $type-break-empty-vs-i32 (result i32)
   598      (block (result i32) (br 0) (i32.const 1))
   599    ))
   600    "type mismatch"
   601  )
   602  (assert_invalid
   603    (module (func $type-break-empty-vs-i64 (result i64)
   604      (block (result i64) (br 0) (i64.const 1))
   605    ))
   606    "type mismatch"
   607  )
   608  (assert_invalid
   609    (module (func $type-break-empty-vs-f32 (result f32)
   610      (block (result f32) (br 0) (f32.const 1.0))
   611    ))
   612    "type mismatch"
   613  )
   614  (assert_invalid
   615    (module (func $type-break-empty-vs-f64 (result f64)
   616      (block (result f64) (br 0) (f64.const 1.0))
   617    ))
   618    "type mismatch"
   619  )
   620  
   621  (assert_invalid
   622    (module (func $type-break-void-vs-i32 (result i32)
   623      (block (result i32) (br 0 (nop)) (i32.const 1))
   624    ))
   625    "type mismatch"
   626  )
   627  (assert_invalid
   628    (module (func $type-break-void-vs-i64 (result i64)
   629      (block (result i64) (br 0 (nop)) (i64.const 1))
   630    ))
   631    "type mismatch"
   632  )
   633  (assert_invalid
   634    (module (func $type-break-void-vs-f32 (result f32)
   635      (block (result f32) (br 0 (nop)) (f32.const 1.0))
   636    ))
   637    "type mismatch"
   638  )
   639  (assert_invalid
   640    (module (func $type-break-void-vs-f64 (result f64)
   641      (block (result f64) (br 0 (nop)) (f64.const 1.0))
   642    ))
   643    "type mismatch"
   644  )
   645  
   646  (assert_invalid
   647    (module (func $type-break-i32-vs-i64 (result i32)
   648      (block (result i32) (br 0 (i64.const 1)) (i32.const 1))
   649    ))
   650    "type mismatch"
   651  )
   652  (assert_invalid
   653    (module (func $type-break-i32-vs-f32 (result i32)
   654      (block (result i32) (br 0 (f32.const 1.0)) (i32.const 1))
   655    ))
   656    "type mismatch"
   657  )
   658  (assert_invalid
   659    (module (func $type-break-i32-vs-f64 (result i32)
   660      (block (result i32) (br 0 (f64.const 1.0)) (i32.const 1))
   661    ))
   662    "type mismatch"
   663  )
   664  (assert_invalid
   665    (module (func $type-break-i64-vs-i32 (result i64)
   666      (block (result i64) (br 0 (i32.const 1)) (i64.const 1))
   667    ))
   668    "type mismatch"
   669  )
   670  (assert_invalid
   671    (module (func $type-break-i64-vs-f32 (result i64)
   672      (block (result i64) (br 0 (f32.const 1.0)) (i64.const 1))
   673    ))
   674    "type mismatch"
   675  )
   676  (assert_invalid
   677    (module (func $type-break-i64-vs-f64 (result i64)
   678      (block (result i64) (br 0 (f64.const 1.0)) (i64.const 1))
   679    ))
   680    "type mismatch"
   681  )
   682  (assert_invalid
   683    (module (func $type-break-f32-vs-i32 (result f32)
   684      (block (result f32) (br 0 (i32.const 1)) (f32.const 1.0))
   685    ))
   686    "type mismatch"
   687  )
   688  (assert_invalid
   689    (module (func $type-break-f32-vs-i64 (result f32)
   690      (block (result f32) (br 0 (i64.const 1)) (f32.const 1.0))
   691    ))
   692    "type mismatch"
   693  )
   694  (assert_invalid
   695    (module (func $type-break-f32-vs-f64 (result f32)
   696      (block (result f32) (br 0 (f64.const 1.0)) (f32.const 1.0))
   697    ))
   698    "type mismatch"
   699  )
   700  (assert_invalid
   701    (module (func $type-break-f64-vs-i32 (result f64)
   702      (block (result i64) (br 0 (i32.const 1)) (f64.const 1.0))
   703    ))
   704    "type mismatch"
   705  )
   706  (assert_invalid
   707    (module (func $type-break-f64-vs-i64 (result f64)
   708      (block (result f64) (br 0 (i64.const 1)) (f64.const 1.0))
   709    ))
   710    "type mismatch"
   711  )
   712  (assert_invalid
   713    (module (func $type-break-f64-vs-f32 (result f64)
   714      (block (result f64) (br 0 (f32.const 1.0)) (f64.const 1))
   715    ))
   716    "type mismatch"
   717  )
   718  
   719  (assert_invalid
   720    (module (func $type-break-first-void-vs-i32 (result i32)
   721      (block (result i32) (br 0 (nop)) (br 0 (i32.const 1)))
   722    ))
   723    "type mismatch"
   724  )
   725  (assert_invalid
   726    (module (func $type-break-first-void-vs-i64 (result i64)
   727      (block (result i64) (br 0 (nop)) (br 0 (i64.const 1)))
   728    ))
   729    "type mismatch"
   730  )
   731  (assert_invalid
   732    (module (func $type-break-first-void-vs-f32 (result f32)
   733      (block (result f32) (br 0 (nop)) (br 0 (f32.const 1.0)))
   734    ))
   735    "type mismatch"
   736  )
   737  (assert_invalid
   738    (module (func $type-break-first-void-vs-f64 (result f64)
   739      (block (result f64) (br 0 (nop)) (br 0 (f64.const 1.0)))
   740    ))
   741    "type mismatch"
   742  )
   743  
   744  (assert_invalid
   745    (module (func $type-break-first-i32-vs-i64 (result i32)
   746      (block (result i32) (br 0 (i64.const 1)) (br 0 (i32.const 1)))
   747    ))
   748    "type mismatch"
   749  )
   750  (assert_invalid
   751    (module (func $type-break-first-i32-vs-f32 (result i32)
   752      (block (result i32) (br 0 (f32.const 1.0)) (br 0 (i32.const 1)))
   753    ))
   754    "type mismatch"
   755  )
   756  (assert_invalid
   757    (module (func $type-break-first-i32-vs-f64 (result i32)
   758      (block (result i32) (br 0 (f64.const 1.0)) (br 0 (i32.const 1)))
   759    ))
   760    "type mismatch"
   761  )
   762  (assert_invalid
   763    (module (func $type-break-first-i64-vs-i32 (result i64)
   764      (block (result i64) (br 0 (i32.const 1)) (br 0 (i64.const 1)))
   765    ))
   766    "type mismatch"
   767  )
   768  (assert_invalid
   769    (module (func $type-break-first-i64-vs-f32 (result i64)
   770      (block (result i64) (br 0 (f32.const 1.0)) (br 0 (i64.const 1)))
   771    ))
   772    "type mismatch"
   773  )
   774  (assert_invalid
   775    (module (func $type-break-first-i64-vs-f64 (result i64)
   776      (block (result i64) (br 0 (f64.const 1.0)) (br 0 (i64.const 1)))
   777    ))
   778    "type mismatch"
   779  )
   780  (assert_invalid
   781    (module (func $type-break-first-f32-vs-i32 (result f32)
   782      (block (result f32) (br 0 (i32.const 1)) (br 0 (f32.const 1.0)))
   783    ))
   784    "type mismatch"
   785  )
   786  (assert_invalid
   787    (module (func $type-break-first-f32-vs-i64 (result f32)
   788      (block (result f32) (br 0 (i64.const 1)) (br 0 (f32.const 1.0)))
   789    ))
   790    "type mismatch"
   791  )
   792  (assert_invalid
   793    (module (func $type-break-first-f32-vs-f64 (result f32)
   794      (block (result f32) (br 0 (f64.const 1.0)) (br 0 (f32.const 1.0)))
   795    ))
   796    "type mismatch"
   797  )
   798  (assert_invalid
   799    (module (func $type-break-first-f64-vs-i32 (result f64)
   800      (block (result f64) (br 0 (i32.const 1)) (br 0 (f64.const 1.0)))
   801    ))
   802    "type mismatch"
   803  )
   804  (assert_invalid
   805    (module (func $type-break-first-f64-vs-i64 (result f64)
   806      (block (result f64) (br 0 (i64.const 1)) (br 0 (f64.const 1.0)))
   807    ))
   808    "type mismatch"
   809  )
   810  (assert_invalid
   811    (module (func $type-break-first-f64-vs-f32 (result f64)
   812      (block (result f64) (br 0 (f32.const 1.0)) (br 0 (f64.const 1.0)))
   813    ))
   814    "type mismatch"
   815  )
   816  
   817  (assert_invalid
   818    (module (func $type-break-nested-i32-vs-void
   819      (block (result i32) (block (result i32) (br 1 (i32.const 1))) (br 0))
   820    ))
   821    "type mismatch"
   822  )
   823  (assert_invalid
   824    (module (func $type-break-nested-i64-vs-void
   825      (block (result i64) (block (result i64) (br 1 (i64.const 1))) (br 0))
   826    ))
   827    "type mismatch"
   828  )
   829  (assert_invalid
   830    (module (func $type-break-nested-f32-vs-void
   831      (block (result f32) (block (result f32) (br 1 (f32.const 1.0))) (br 0))
   832    ))
   833    "type mismatch"
   834  )
   835  (assert_invalid
   836    (module (func $type-break-nested-f64-vs-void
   837      (block (result f64) (block (result f64) (br 1 (f64.const 1.0))) (br 0))
   838    ))
   839    "type mismatch"
   840  )
   841  
   842  (assert_invalid
   843    (module (func $type-break-nested-empty-vs-i32 (result i32)
   844      (block (result i32) (block (br 1)) (br 0 (i32.const 1)))
   845    ))
   846    "type mismatch"
   847  )
   848  (assert_invalid
   849    (module (func $type-break-nested-empty-vs-i64 (result i64)
   850      (block (result i64) (block (br 1)) (br 0 (i64.const 1)))
   851    ))
   852    "type mismatch"
   853  )
   854  (assert_invalid
   855    (module (func $type-break-nested-empty-vs-f32 (result f32)
   856      (block (result f32) (block (br 1)) (br 0 (f32.const 1.0)))
   857    ))
   858    "type mismatch"
   859  )
   860  (assert_invalid
   861    (module (func $type-break-nested-empty-vs-f64 (result f64)
   862      (block (result f64) (block (br 1)) (br 0 (f64.const 1)))
   863    ))
   864    "type mismatch"
   865  )
   866  
   867  (assert_invalid
   868    (module (func $type-break-nested-void-vs-i32 (result i32)
   869      (block (result i32) (block (result i32) (br 1 (nop))) (br 0 (i32.const 1)))
   870    ))
   871    "type mismatch"
   872  )
   873  (assert_invalid
   874    (module (func $type-break-nested-void-vs-i64 (result i64)
   875      (block (result i64) (block (result i64) (br 1 (nop))) (br 0 (i64.const 1)))
   876    ))
   877    "type mismatch"
   878  )
   879  (assert_invalid
   880    (module (func $type-break-nested-void-vs-f32 (result f32)
   881      (block (result f32) (block (result f32) (br 1 (nop))) (br 0 (f32.const 1.0)))
   882    ))
   883    "type mismatch"
   884  )
   885  (assert_invalid
   886    (module (func $type-break-nested-void-vs-f64 (result f64)
   887      (block (result f64) (block (result f64) (br 1 (nop))) (br 0 (f64.const 1.0)))
   888    ))
   889    "type mismatch"
   890  )
   891  
   892  (assert_invalid
   893    (module (func $type-break-nested-i32-vs-i64 (result i32)
   894      (block (result i32)
   895        (block (result i32) (br 1 (i64.const 1))) (br 0 (i32.const 1))
   896      )
   897    ))
   898    "type mismatch"
   899  )
   900  (assert_invalid
   901    (module (func $type-break-nested-i32-vs-f32 (result i32)
   902      (block (result i32)
   903        (block (result i32) (br 1 (f32.const 1.0))) (br 0 (i32.const 1))
   904      )
   905    ))
   906    "type mismatch"
   907  )
   908  (assert_invalid
   909    (module (func $type-break-nested-i32-vs-f64 (result i32)
   910      (block (result i32)
   911        (block (result i32) (br 1 (f64.const 1.0))) (br 0 (i32.const 1))
   912      )
   913    ))
   914    "type mismatch"
   915  )
   916  (assert_invalid
   917    (module (func $type-break-nested-i64-vs-i32 (result i64)
   918      (block (result i64)
   919        (block (result i64) (br 1 (i32.const 1))) (br 0 (i64.const 1))
   920      )
   921    ))
   922    "type mismatch"
   923  )
   924  (assert_invalid
   925    (module (func $type-break-nested-i64-vs-f32 (result i64)
   926      (block (result i64)
   927        (block (result i64) (br 1 (f32.const 1.0))) (br 0 (i64.const 1))
   928      )
   929    ))
   930    "type mismatch"
   931  )
   932  (assert_invalid
   933    (module (func $type-break-nested-i64-vs-f64 (result i64)
   934      (block (result i64)
   935        (block (result i64) (br 1 (f64.const 1.0))) (br 0 (i64.const 1))
   936      )
   937    ))
   938    "type mismatch"
   939  )
   940  (assert_invalid
   941    (module (func $type-break-nested-f32-vs-i32 (result f32)
   942      (block (result f32)
   943        (block (result f32) (br 1 (i32.const 1))) (br 0 (f32.const 1.0))
   944      )
   945    ))
   946    "type mismatch"
   947  )
   948  (assert_invalid
   949    (module (func $type-break-nested-f32-vs-i64 (result f32)
   950      (block (result f32)
   951        (block (result f32) (br 1 (i64.const 1))) (br 0 (f32.const 1.0))
   952      )
   953    ))
   954    "type mismatch"
   955  )
   956  (assert_invalid
   957    (module (func $type-break-nested-f32-vs-f64 (result f32)
   958      (block (result f32)
   959        (block (result f32) (br 1 (f64.const 1.0))) (br 0 (f32.const 1.0))
   960      )
   961    ))
   962    "type mismatch"
   963  )
   964  (assert_invalid
   965    (module (func $type-break-nested-f64-vs-i32 (result f64)
   966      (block (result f64)
   967        (block (result f64) (br 1 (i32.const 1))) (br 0 (f64.const 1.0))
   968      )
   969    ))
   970    "type mismatch"
   971  )
   972  (assert_invalid
   973    (module (func $type-break-nested-f64-vs-i64 (result f64)
   974      (block (result f64)
   975        (block (result f64) (br 1 (i64.const 1))) (br 0 (f64.const 1.0))
   976      )
   977    ))
   978    "type mismatch"
   979  )
   980  (assert_invalid
   981    (module (func $type-break-nested-f64-vs-f32 (result f64)
   982      (block (result f64)
   983        (block (result f64) (br 1 (f32.const 1.0))) (br 0 (f64.const 1.0))
   984      )
   985    ))
   986    "type mismatch"
   987  )
   988  
   989  (assert_invalid
   990    (module (func $type-break-operand-empty-vs-i32 (result i32)
   991      (i32.ctz (block (br 0)))
   992    ))
   993    "type mismatch"
   994  )
   995  (assert_invalid
   996    (module (func $type-break-operand-empty-vs-i64 (result i64)
   997      (i64.ctz (block (br 0)))
   998    ))
   999    "type mismatch"
  1000  )
  1001  (assert_invalid
  1002    (module (func $type-break-operand-empty-vs-f32 (result f32)
  1003      (f32.floor (block (br 0)))
  1004    ))
  1005    "type mismatch"
  1006  )
  1007  (assert_invalid
  1008    (module (func $type-break-operand-empty-vs-f64 (result f64)
  1009      (f64.floor (block (br 0)))
  1010    ))
  1011    "type mismatch"
  1012  )
  1013  
  1014  (assert_invalid
  1015    (module (func $type-break-operand-void-vs-i32 (result i32)
  1016      (i32.ctz (block (br 0 (nop))))
  1017    ))
  1018    "type mismatch"
  1019  )
  1020  (assert_invalid
  1021    (module (func $type-break-operand-void-vs-i64 (result i64)
  1022      (i64.ctz (block (br 0 (nop))))
  1023    ))
  1024    "type mismatch"
  1025  )
  1026  (assert_invalid
  1027    (module (func $type-break-operand-void-vs-f32 (result f32)
  1028      (f32.floor (block (br 0 (nop))))
  1029    ))
  1030    "type mismatch"
  1031  )
  1032  (assert_invalid
  1033    (module (func $type-break-operand-void-vs-f64 (result f64)
  1034      (f64.floor (block (br 0 (nop))))
  1035    ))
  1036    "type mismatch"
  1037  )
  1038  
  1039  (assert_invalid
  1040    (module (func $type-break-operand-i32-vs-i64 (result i32)
  1041      (i64.ctz (block (br 0 (i64.const 9))))
  1042    ))
  1043    "type mismatch"
  1044  )
  1045  (assert_invalid
  1046    (module (func $type-break-operand-i32-vs-f32 (result i32)
  1047      (f32.floor (block (br 0 (f32.const 9.0))))
  1048    ))
  1049    "type mismatch"
  1050  )
  1051  (assert_invalid
  1052    (module (func $type-break-operand-i32-vs-f64 (result i32)
  1053      (f64.floor (block (br 0 (f64.const 9.0))))
  1054    ))
  1055    "type mismatch"
  1056  )
  1057  (assert_invalid
  1058    (module (func $type-break-operand-i64-vs-i32 (result i64)
  1059      (i32.ctz (block (br 0 (i32.const 9))))
  1060    ))
  1061    "type mismatch"
  1062  )
  1063  (assert_invalid
  1064    (module (func $type-break-operand-i64-vs-f32 (result i64)
  1065      (f32.floor (block (br 0 (f32.const 9.0))))
  1066    ))
  1067    "type mismatch"
  1068  )
  1069  (assert_invalid
  1070    (module (func $type-break-operand-i64-vs-f64 (result i64)
  1071      (f64.floor (block (br 0 (f64.const 9.0))))
  1072    ))
  1073    "type mismatch"
  1074  )
  1075  (assert_invalid
  1076    (module (func $type-break-operand-f32-vs-i32 (result f32)
  1077      (i32.ctz (block (br 0 (i32.const 9))))
  1078    ))
  1079    "type mismatch"
  1080  )
  1081  (assert_invalid
  1082    (module (func $type-break-operand-f32-vs-i64 (result f32)
  1083      (i64.ctz (block (br 0 (i64.const 9))))
  1084    ))
  1085    "type mismatch"
  1086  )
  1087  (assert_invalid
  1088    (module (func $type-break-operand-f32-vs-f64 (result f32)
  1089      (f64.floor (block (br 0 (f64.const 9.0))))
  1090    ))
  1091    "type mismatch"
  1092  )
  1093  (assert_invalid
  1094    (module (func $type-break-operand-f64-vs-i32 (result f64)
  1095      (i32.ctz (block (br 0 (i32.const 9))))
  1096    ))
  1097    "type mismatch"
  1098  )
  1099  (assert_invalid
  1100    (module (func $type-break-operand-f64-vs-i64 (result f64)
  1101      (i64.ctz (block (br 0 (i64.const 9))))
  1102    ))
  1103    "type mismatch"
  1104  )
  1105  (assert_invalid
  1106    (module (func $type-break-operand-f64-vs-f32 (result f64)
  1107      (f32.floor (block (br 0 (f32.const 9.0))))
  1108    ))
  1109    "type mismatch"
  1110  )
  1111  
  1112  
  1113  (assert_malformed
  1114    (module quote "(func block end $l)")
  1115    "mismatching label"
  1116  )
  1117  (assert_malformed
  1118    (module quote "(func block $a end $l)")
  1119    "mismatching label"
  1120  )