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

     1  ;;
     2  ;; Generated by ../meta/generate_memory_init.js
     3  ;; DO NOT EDIT THIS FILE.  CHANGE THE SOURCE AND REGENERATE.
     4  ;;
     5  
     6  (module
     7    (memory (export "memory0") 1 1)
     8    (data (i32.const 2) "\03\01\04\01")
     9    (data "\02\07\01\08")
    10    (data (i32.const 12) "\07\05\02\03\06")
    11    (data "\05\09\02\07\06")
    12    (func (export "test")
    13      (nop))
    14    (func (export "load8_u") (param i32) (result i32)
    15      (i32.load8_u (local.get 0))))
    16  
    17  (invoke "test")
    18  
    19  (assert_return (invoke "load8_u" (i32.const 0)) (i32.const 0))
    20  (assert_return (invoke "load8_u" (i32.const 1)) (i32.const 0))
    21  (assert_return (invoke "load8_u" (i32.const 2)) (i32.const 3))
    22  (assert_return (invoke "load8_u" (i32.const 3)) (i32.const 1))
    23  (assert_return (invoke "load8_u" (i32.const 4)) (i32.const 4))
    24  (assert_return (invoke "load8_u" (i32.const 5)) (i32.const 1))
    25  (assert_return (invoke "load8_u" (i32.const 6)) (i32.const 0))
    26  (assert_return (invoke "load8_u" (i32.const 7)) (i32.const 0))
    27  (assert_return (invoke "load8_u" (i32.const 8)) (i32.const 0))
    28  (assert_return (invoke "load8_u" (i32.const 9)) (i32.const 0))
    29  (assert_return (invoke "load8_u" (i32.const 10)) (i32.const 0))
    30  (assert_return (invoke "load8_u" (i32.const 11)) (i32.const 0))
    31  (assert_return (invoke "load8_u" (i32.const 12)) (i32.const 7))
    32  (assert_return (invoke "load8_u" (i32.const 13)) (i32.const 5))
    33  (assert_return (invoke "load8_u" (i32.const 14)) (i32.const 2))
    34  (assert_return (invoke "load8_u" (i32.const 15)) (i32.const 3))
    35  (assert_return (invoke "load8_u" (i32.const 16)) (i32.const 6))
    36  (assert_return (invoke "load8_u" (i32.const 17)) (i32.const 0))
    37  (assert_return (invoke "load8_u" (i32.const 18)) (i32.const 0))
    38  (assert_return (invoke "load8_u" (i32.const 19)) (i32.const 0))
    39  (assert_return (invoke "load8_u" (i32.const 20)) (i32.const 0))
    40  (assert_return (invoke "load8_u" (i32.const 21)) (i32.const 0))
    41  (assert_return (invoke "load8_u" (i32.const 22)) (i32.const 0))
    42  (assert_return (invoke "load8_u" (i32.const 23)) (i32.const 0))
    43  (assert_return (invoke "load8_u" (i32.const 24)) (i32.const 0))
    44  (assert_return (invoke "load8_u" (i32.const 25)) (i32.const 0))
    45  (assert_return (invoke "load8_u" (i32.const 26)) (i32.const 0))
    46  (assert_return (invoke "load8_u" (i32.const 27)) (i32.const 0))
    47  (assert_return (invoke "load8_u" (i32.const 28)) (i32.const 0))
    48  (assert_return (invoke "load8_u" (i32.const 29)) (i32.const 0))
    49  
    50  (module
    51    (memory (export "memory0") 1 1)
    52    (data (i32.const 2) "\03\01\04\01")
    53    (data "\02\07\01\08")
    54    (data (i32.const 12) "\07\05\02\03\06")
    55    (data "\05\09\02\07\06")
    56    (func (export "test")
    57      (memory.init 1 (i32.const 7) (i32.const 0) (i32.const 4)))
    58    (func (export "load8_u") (param i32) (result i32)
    59      (i32.load8_u (local.get 0))))
    60  
    61  (invoke "test")
    62  
    63  (assert_return (invoke "load8_u" (i32.const 0)) (i32.const 0))
    64  (assert_return (invoke "load8_u" (i32.const 1)) (i32.const 0))
    65  (assert_return (invoke "load8_u" (i32.const 2)) (i32.const 3))
    66  (assert_return (invoke "load8_u" (i32.const 3)) (i32.const 1))
    67  (assert_return (invoke "load8_u" (i32.const 4)) (i32.const 4))
    68  (assert_return (invoke "load8_u" (i32.const 5)) (i32.const 1))
    69  (assert_return (invoke "load8_u" (i32.const 6)) (i32.const 0))
    70  (assert_return (invoke "load8_u" (i32.const 7)) (i32.const 2))
    71  (assert_return (invoke "load8_u" (i32.const 8)) (i32.const 7))
    72  (assert_return (invoke "load8_u" (i32.const 9)) (i32.const 1))
    73  (assert_return (invoke "load8_u" (i32.const 10)) (i32.const 8))
    74  (assert_return (invoke "load8_u" (i32.const 11)) (i32.const 0))
    75  (assert_return (invoke "load8_u" (i32.const 12)) (i32.const 7))
    76  (assert_return (invoke "load8_u" (i32.const 13)) (i32.const 5))
    77  (assert_return (invoke "load8_u" (i32.const 14)) (i32.const 2))
    78  (assert_return (invoke "load8_u" (i32.const 15)) (i32.const 3))
    79  (assert_return (invoke "load8_u" (i32.const 16)) (i32.const 6))
    80  (assert_return (invoke "load8_u" (i32.const 17)) (i32.const 0))
    81  (assert_return (invoke "load8_u" (i32.const 18)) (i32.const 0))
    82  (assert_return (invoke "load8_u" (i32.const 19)) (i32.const 0))
    83  (assert_return (invoke "load8_u" (i32.const 20)) (i32.const 0))
    84  (assert_return (invoke "load8_u" (i32.const 21)) (i32.const 0))
    85  (assert_return (invoke "load8_u" (i32.const 22)) (i32.const 0))
    86  (assert_return (invoke "load8_u" (i32.const 23)) (i32.const 0))
    87  (assert_return (invoke "load8_u" (i32.const 24)) (i32.const 0))
    88  (assert_return (invoke "load8_u" (i32.const 25)) (i32.const 0))
    89  (assert_return (invoke "load8_u" (i32.const 26)) (i32.const 0))
    90  (assert_return (invoke "load8_u" (i32.const 27)) (i32.const 0))
    91  (assert_return (invoke "load8_u" (i32.const 28)) (i32.const 0))
    92  (assert_return (invoke "load8_u" (i32.const 29)) (i32.const 0))
    93  
    94  (module
    95    (memory (export "memory0") 1 1)
    96    (data (i32.const 2) "\03\01\04\01")
    97    (data "\02\07\01\08")
    98    (data (i32.const 12) "\07\05\02\03\06")
    99    (data "\05\09\02\07\06")
   100    (func (export "test")
   101      (memory.init 3 (i32.const 15) (i32.const 1) (i32.const 3)))
   102    (func (export "load8_u") (param i32) (result i32)
   103      (i32.load8_u (local.get 0))))
   104  
   105  (invoke "test")
   106  
   107  (assert_return (invoke "load8_u" (i32.const 0)) (i32.const 0))
   108  (assert_return (invoke "load8_u" (i32.const 1)) (i32.const 0))
   109  (assert_return (invoke "load8_u" (i32.const 2)) (i32.const 3))
   110  (assert_return (invoke "load8_u" (i32.const 3)) (i32.const 1))
   111  (assert_return (invoke "load8_u" (i32.const 4)) (i32.const 4))
   112  (assert_return (invoke "load8_u" (i32.const 5)) (i32.const 1))
   113  (assert_return (invoke "load8_u" (i32.const 6)) (i32.const 0))
   114  (assert_return (invoke "load8_u" (i32.const 7)) (i32.const 0))
   115  (assert_return (invoke "load8_u" (i32.const 8)) (i32.const 0))
   116  (assert_return (invoke "load8_u" (i32.const 9)) (i32.const 0))
   117  (assert_return (invoke "load8_u" (i32.const 10)) (i32.const 0))
   118  (assert_return (invoke "load8_u" (i32.const 11)) (i32.const 0))
   119  (assert_return (invoke "load8_u" (i32.const 12)) (i32.const 7))
   120  (assert_return (invoke "load8_u" (i32.const 13)) (i32.const 5))
   121  (assert_return (invoke "load8_u" (i32.const 14)) (i32.const 2))
   122  (assert_return (invoke "load8_u" (i32.const 15)) (i32.const 9))
   123  (assert_return (invoke "load8_u" (i32.const 16)) (i32.const 2))
   124  (assert_return (invoke "load8_u" (i32.const 17)) (i32.const 7))
   125  (assert_return (invoke "load8_u" (i32.const 18)) (i32.const 0))
   126  (assert_return (invoke "load8_u" (i32.const 19)) (i32.const 0))
   127  (assert_return (invoke "load8_u" (i32.const 20)) (i32.const 0))
   128  (assert_return (invoke "load8_u" (i32.const 21)) (i32.const 0))
   129  (assert_return (invoke "load8_u" (i32.const 22)) (i32.const 0))
   130  (assert_return (invoke "load8_u" (i32.const 23)) (i32.const 0))
   131  (assert_return (invoke "load8_u" (i32.const 24)) (i32.const 0))
   132  (assert_return (invoke "load8_u" (i32.const 25)) (i32.const 0))
   133  (assert_return (invoke "load8_u" (i32.const 26)) (i32.const 0))
   134  (assert_return (invoke "load8_u" (i32.const 27)) (i32.const 0))
   135  (assert_return (invoke "load8_u" (i32.const 28)) (i32.const 0))
   136  (assert_return (invoke "load8_u" (i32.const 29)) (i32.const 0))
   137  
   138  (module
   139    (memory (export "memory0") 1 1)
   140    (data (i32.const 2) "\03\01\04\01")
   141    (data "\02\07\01\08")
   142    (data (i32.const 12) "\07\05\02\03\06")
   143    (data "\05\09\02\07\06")
   144    (func (export "test")
   145      (memory.init 1 (i32.const 7) (i32.const 0) (i32.const 4))
   146      (data.drop 1)
   147      (memory.init 3 (i32.const 15) (i32.const 1) (i32.const 3))
   148      (data.drop 3)
   149      (memory.copy (i32.const 20) (i32.const 15) (i32.const 5))
   150      (memory.copy (i32.const 21) (i32.const 29) (i32.const 1))
   151      (memory.copy (i32.const 24) (i32.const 10) (i32.const 1))
   152      (memory.copy (i32.const 13) (i32.const 11) (i32.const 4))
   153      (memory.copy (i32.const 19) (i32.const 20) (i32.const 5)))
   154    (func (export "load8_u") (param i32) (result i32)
   155      (i32.load8_u (local.get 0))))
   156  
   157  (invoke "test")
   158  
   159  (assert_return (invoke "load8_u" (i32.const 0)) (i32.const 0))
   160  (assert_return (invoke "load8_u" (i32.const 1)) (i32.const 0))
   161  (assert_return (invoke "load8_u" (i32.const 2)) (i32.const 3))
   162  (assert_return (invoke "load8_u" (i32.const 3)) (i32.const 1))
   163  (assert_return (invoke "load8_u" (i32.const 4)) (i32.const 4))
   164  (assert_return (invoke "load8_u" (i32.const 5)) (i32.const 1))
   165  (assert_return (invoke "load8_u" (i32.const 6)) (i32.const 0))
   166  (assert_return (invoke "load8_u" (i32.const 7)) (i32.const 2))
   167  (assert_return (invoke "load8_u" (i32.const 8)) (i32.const 7))
   168  (assert_return (invoke "load8_u" (i32.const 9)) (i32.const 1))
   169  (assert_return (invoke "load8_u" (i32.const 10)) (i32.const 8))
   170  (assert_return (invoke "load8_u" (i32.const 11)) (i32.const 0))
   171  (assert_return (invoke "load8_u" (i32.const 12)) (i32.const 7))
   172  (assert_return (invoke "load8_u" (i32.const 13)) (i32.const 0))
   173  (assert_return (invoke "load8_u" (i32.const 14)) (i32.const 7))
   174  (assert_return (invoke "load8_u" (i32.const 15)) (i32.const 5))
   175  (assert_return (invoke "load8_u" (i32.const 16)) (i32.const 2))
   176  (assert_return (invoke "load8_u" (i32.const 17)) (i32.const 7))
   177  (assert_return (invoke "load8_u" (i32.const 18)) (i32.const 0))
   178  (assert_return (invoke "load8_u" (i32.const 19)) (i32.const 9))
   179  (assert_return (invoke "load8_u" (i32.const 20)) (i32.const 0))
   180  (assert_return (invoke "load8_u" (i32.const 21)) (i32.const 7))
   181  (assert_return (invoke "load8_u" (i32.const 22)) (i32.const 0))
   182  (assert_return (invoke "load8_u" (i32.const 23)) (i32.const 8))
   183  (assert_return (invoke "load8_u" (i32.const 24)) (i32.const 8))
   184  (assert_return (invoke "load8_u" (i32.const 25)) (i32.const 0))
   185  (assert_return (invoke "load8_u" (i32.const 26)) (i32.const 0))
   186  (assert_return (invoke "load8_u" (i32.const 27)) (i32.const 0))
   187  (assert_return (invoke "load8_u" (i32.const 28)) (i32.const 0))
   188  (assert_return (invoke "load8_u" (i32.const 29)) (i32.const 0))
   189  (assert_invalid
   190     (module
   191       (func (export "test")
   192         (data.drop 0)))
   193     "unknown data segment")
   194  
   195  (assert_invalid
   196    (module
   197      (memory 1)
   198      (data "\37")
   199      (func (export "test")
   200        (data.drop 4)))
   201    "unknown data segment")
   202  
   203  (module
   204    (memory 1)
   205      (data "\37")
   206    (func (export "test")
   207      (data.drop 0)
   208      (data.drop 0)))
   209  (invoke "test")
   210  
   211  (module
   212    (memory 1)
   213      (data "\37")
   214    (func (export "test")
   215      (data.drop 0)
   216      (memory.init 0 (i32.const 1234) (i32.const 1) (i32.const 1))))
   217  (assert_trap (invoke "test") "out of bounds memory access")
   218  
   219  (module
   220     (memory 1)
   221     (data (i32.const 0) "\37")
   222     (func (export "test")
   223       (memory.init 0 (i32.const 1234) (i32.const 1) (i32.const 1))))
   224  (assert_trap (invoke "test") "out of bounds memory access")
   225  
   226  (assert_invalid
   227    (module
   228      (func (export "test")
   229        (memory.init 1 (i32.const 1234) (i32.const 1) (i32.const 1))))
   230    "unknown memory 0")
   231  
   232  (assert_invalid
   233    (module
   234      (memory 1)
   235      (data "\37")
   236      (func (export "test")
   237        (memory.init 1 (i32.const 1234) (i32.const 1) (i32.const 1))))
   238    "unknown data segment 1")
   239  
   240  (module
   241    (memory 1)
   242      (data "\37")
   243    (func (export "test")
   244      (memory.init 0 (i32.const 1) (i32.const 0) (i32.const 1))
   245      (memory.init 0 (i32.const 1) (i32.const 0) (i32.const 1))))
   246  (invoke "test")
   247  
   248  (module
   249    (memory 1)
   250      (data "\37")
   251    (func (export "test")
   252      (memory.init 0 (i32.const 1234) (i32.const 0) (i32.const 5))))
   253  (assert_trap (invoke "test") "out of bounds memory access")
   254  
   255  (module
   256    (memory 1)
   257      (data "\37")
   258    (func (export "test")
   259      (memory.init 0 (i32.const 1234) (i32.const 2) (i32.const 3))))
   260  (assert_trap (invoke "test") "out of bounds memory access")
   261  
   262  (module
   263    (memory 1)
   264      (data "\37")
   265    (func (export "test")
   266      (memory.init 0 (i32.const 0xFFFE) (i32.const 1) (i32.const 3))))
   267  (assert_trap (invoke "test") "out of bounds memory access")
   268  
   269  (module
   270    (memory 1)
   271      (data "\37")
   272    (func (export "test")
   273      (memory.init 0 (i32.const 1234) (i32.const 4) (i32.const 0))))
   274  (assert_trap (invoke "test") "out of bounds memory access")
   275  
   276  (module
   277    (memory 1)
   278      (data "\37")
   279    (func (export "test")
   280      (memory.init 0 (i32.const 1234) (i32.const 1) (i32.const 0))))
   281  (invoke "test")
   282  
   283  (module
   284    (memory 1)
   285      (data "\37")
   286    (func (export "test")
   287      (memory.init 0 (i32.const 0x10001) (i32.const 0) (i32.const 0))))
   288  (assert_trap (invoke "test") "out of bounds memory access")
   289  
   290  (module
   291    (memory 1)
   292      (data "\37")
   293    (func (export "test")
   294      (memory.init 0 (i32.const 0x10000) (i32.const 0) (i32.const 0))))
   295  (invoke "test")
   296  
   297  (module
   298    (memory 1)
   299      (data "\37")
   300    (func (export "test")
   301      (memory.init 0 (i32.const 0x10000) (i32.const 1) (i32.const 0))))
   302  (invoke "test")
   303  
   304  (module
   305    (memory 1)
   306      (data "\37")
   307    (func (export "test")
   308      (memory.init 0 (i32.const 0x10001) (i32.const 4) (i32.const 0))))
   309  (assert_trap (invoke "test") "out of bounds memory access")
   310  
   311  (assert_invalid
   312    (module
   313      (memory 1)
   314      (data "\37")
   315      (func (export "test")
   316        (memory.init 0 (i32.const 1) (i32.const 1) (f32.const 1))))
   317    "type mismatch")
   318  
   319  (assert_invalid
   320    (module
   321      (memory 1)
   322      (data "\37")
   323      (func (export "test")
   324        (memory.init 0 (i32.const 1) (i32.const 1) (i64.const 1))))
   325    "type mismatch")
   326  
   327  (assert_invalid
   328    (module
   329      (memory 1)
   330      (data "\37")
   331      (func (export "test")
   332        (memory.init 0 (i32.const 1) (i32.const 1) (f64.const 1))))
   333    "type mismatch")
   334  
   335  (assert_invalid
   336    (module
   337      (memory 1)
   338      (data "\37")
   339      (func (export "test")
   340        (memory.init 0 (i32.const 1) (f32.const 1) (i32.const 1))))
   341    "type mismatch")
   342  
   343  (assert_invalid
   344    (module
   345      (memory 1)
   346      (data "\37")
   347      (func (export "test")
   348        (memory.init 0 (i32.const 1) (f32.const 1) (f32.const 1))))
   349    "type mismatch")
   350  
   351  (assert_invalid
   352    (module
   353      (memory 1)
   354      (data "\37")
   355      (func (export "test")
   356        (memory.init 0 (i32.const 1) (f32.const 1) (i64.const 1))))
   357    "type mismatch")
   358  
   359  (assert_invalid
   360    (module
   361      (memory 1)
   362      (data "\37")
   363      (func (export "test")
   364        (memory.init 0 (i32.const 1) (f32.const 1) (f64.const 1))))
   365    "type mismatch")
   366  
   367  (assert_invalid
   368    (module
   369      (memory 1)
   370      (data "\37")
   371      (func (export "test")
   372        (memory.init 0 (i32.const 1) (i64.const 1) (i32.const 1))))
   373    "type mismatch")
   374  
   375  (assert_invalid
   376    (module
   377      (memory 1)
   378      (data "\37")
   379      (func (export "test")
   380        (memory.init 0 (i32.const 1) (i64.const 1) (f32.const 1))))
   381    "type mismatch")
   382  
   383  (assert_invalid
   384    (module
   385      (memory 1)
   386      (data "\37")
   387      (func (export "test")
   388        (memory.init 0 (i32.const 1) (i64.const 1) (i64.const 1))))
   389    "type mismatch")
   390  
   391  (assert_invalid
   392    (module
   393      (memory 1)
   394      (data "\37")
   395      (func (export "test")
   396        (memory.init 0 (i32.const 1) (i64.const 1) (f64.const 1))))
   397    "type mismatch")
   398  
   399  (assert_invalid
   400    (module
   401      (memory 1)
   402      (data "\37")
   403      (func (export "test")
   404        (memory.init 0 (i32.const 1) (f64.const 1) (i32.const 1))))
   405    "type mismatch")
   406  
   407  (assert_invalid
   408    (module
   409      (memory 1)
   410      (data "\37")
   411      (func (export "test")
   412        (memory.init 0 (i32.const 1) (f64.const 1) (f32.const 1))))
   413    "type mismatch")
   414  
   415  (assert_invalid
   416    (module
   417      (memory 1)
   418      (data "\37")
   419      (func (export "test")
   420        (memory.init 0 (i32.const 1) (f64.const 1) (i64.const 1))))
   421    "type mismatch")
   422  
   423  (assert_invalid
   424    (module
   425      (memory 1)
   426      (data "\37")
   427      (func (export "test")
   428        (memory.init 0 (i32.const 1) (f64.const 1) (f64.const 1))))
   429    "type mismatch")
   430  
   431  (assert_invalid
   432    (module
   433      (memory 1)
   434      (data "\37")
   435      (func (export "test")
   436        (memory.init 0 (f32.const 1) (i32.const 1) (i32.const 1))))
   437    "type mismatch")
   438  
   439  (assert_invalid
   440    (module
   441      (memory 1)
   442      (data "\37")
   443      (func (export "test")
   444        (memory.init 0 (f32.const 1) (i32.const 1) (f32.const 1))))
   445    "type mismatch")
   446  
   447  (assert_invalid
   448    (module
   449      (memory 1)
   450      (data "\37")
   451      (func (export "test")
   452        (memory.init 0 (f32.const 1) (i32.const 1) (i64.const 1))))
   453    "type mismatch")
   454  
   455  (assert_invalid
   456    (module
   457      (memory 1)
   458      (data "\37")
   459      (func (export "test")
   460        (memory.init 0 (f32.const 1) (i32.const 1) (f64.const 1))))
   461    "type mismatch")
   462  
   463  (assert_invalid
   464    (module
   465      (memory 1)
   466      (data "\37")
   467      (func (export "test")
   468        (memory.init 0 (f32.const 1) (f32.const 1) (i32.const 1))))
   469    "type mismatch")
   470  
   471  (assert_invalid
   472    (module
   473      (memory 1)
   474      (data "\37")
   475      (func (export "test")
   476        (memory.init 0 (f32.const 1) (f32.const 1) (f32.const 1))))
   477    "type mismatch")
   478  
   479  (assert_invalid
   480    (module
   481      (memory 1)
   482      (data "\37")
   483      (func (export "test")
   484        (memory.init 0 (f32.const 1) (f32.const 1) (i64.const 1))))
   485    "type mismatch")
   486  
   487  (assert_invalid
   488    (module
   489      (memory 1)
   490      (data "\37")
   491      (func (export "test")
   492        (memory.init 0 (f32.const 1) (f32.const 1) (f64.const 1))))
   493    "type mismatch")
   494  
   495  (assert_invalid
   496    (module
   497      (memory 1)
   498      (data "\37")
   499      (func (export "test")
   500        (memory.init 0 (f32.const 1) (i64.const 1) (i32.const 1))))
   501    "type mismatch")
   502  
   503  (assert_invalid
   504    (module
   505      (memory 1)
   506      (data "\37")
   507      (func (export "test")
   508        (memory.init 0 (f32.const 1) (i64.const 1) (f32.const 1))))
   509    "type mismatch")
   510  
   511  (assert_invalid
   512    (module
   513      (memory 1)
   514      (data "\37")
   515      (func (export "test")
   516        (memory.init 0 (f32.const 1) (i64.const 1) (i64.const 1))))
   517    "type mismatch")
   518  
   519  (assert_invalid
   520    (module
   521      (memory 1)
   522      (data "\37")
   523      (func (export "test")
   524        (memory.init 0 (f32.const 1) (i64.const 1) (f64.const 1))))
   525    "type mismatch")
   526  
   527  (assert_invalid
   528    (module
   529      (memory 1)
   530      (data "\37")
   531      (func (export "test")
   532        (memory.init 0 (f32.const 1) (f64.const 1) (i32.const 1))))
   533    "type mismatch")
   534  
   535  (assert_invalid
   536    (module
   537      (memory 1)
   538      (data "\37")
   539      (func (export "test")
   540        (memory.init 0 (f32.const 1) (f64.const 1) (f32.const 1))))
   541    "type mismatch")
   542  
   543  (assert_invalid
   544    (module
   545      (memory 1)
   546      (data "\37")
   547      (func (export "test")
   548        (memory.init 0 (f32.const 1) (f64.const 1) (i64.const 1))))
   549    "type mismatch")
   550  
   551  (assert_invalid
   552    (module
   553      (memory 1)
   554      (data "\37")
   555      (func (export "test")
   556        (memory.init 0 (f32.const 1) (f64.const 1) (f64.const 1))))
   557    "type mismatch")
   558  
   559  (assert_invalid
   560    (module
   561      (memory 1)
   562      (data "\37")
   563      (func (export "test")
   564        (memory.init 0 (i64.const 1) (i32.const 1) (i32.const 1))))
   565    "type mismatch")
   566  
   567  (assert_invalid
   568    (module
   569      (memory 1)
   570      (data "\37")
   571      (func (export "test")
   572        (memory.init 0 (i64.const 1) (i32.const 1) (f32.const 1))))
   573    "type mismatch")
   574  
   575  (assert_invalid
   576    (module
   577      (memory 1)
   578      (data "\37")
   579      (func (export "test")
   580        (memory.init 0 (i64.const 1) (i32.const 1) (i64.const 1))))
   581    "type mismatch")
   582  
   583  (assert_invalid
   584    (module
   585      (memory 1)
   586      (data "\37")
   587      (func (export "test")
   588        (memory.init 0 (i64.const 1) (i32.const 1) (f64.const 1))))
   589    "type mismatch")
   590  
   591  (assert_invalid
   592    (module
   593      (memory 1)
   594      (data "\37")
   595      (func (export "test")
   596        (memory.init 0 (i64.const 1) (f32.const 1) (i32.const 1))))
   597    "type mismatch")
   598  
   599  (assert_invalid
   600    (module
   601      (memory 1)
   602      (data "\37")
   603      (func (export "test")
   604        (memory.init 0 (i64.const 1) (f32.const 1) (f32.const 1))))
   605    "type mismatch")
   606  
   607  (assert_invalid
   608    (module
   609      (memory 1)
   610      (data "\37")
   611      (func (export "test")
   612        (memory.init 0 (i64.const 1) (f32.const 1) (i64.const 1))))
   613    "type mismatch")
   614  
   615  (assert_invalid
   616    (module
   617      (memory 1)
   618      (data "\37")
   619      (func (export "test")
   620        (memory.init 0 (i64.const 1) (f32.const 1) (f64.const 1))))
   621    "type mismatch")
   622  
   623  (assert_invalid
   624    (module
   625      (memory 1)
   626      (data "\37")
   627      (func (export "test")
   628        (memory.init 0 (i64.const 1) (i64.const 1) (i32.const 1))))
   629    "type mismatch")
   630  
   631  (assert_invalid
   632    (module
   633      (memory 1)
   634      (data "\37")
   635      (func (export "test")
   636        (memory.init 0 (i64.const 1) (i64.const 1) (f32.const 1))))
   637    "type mismatch")
   638  
   639  (assert_invalid
   640    (module
   641      (memory 1)
   642      (data "\37")
   643      (func (export "test")
   644        (memory.init 0 (i64.const 1) (i64.const 1) (i64.const 1))))
   645    "type mismatch")
   646  
   647  (assert_invalid
   648    (module
   649      (memory 1)
   650      (data "\37")
   651      (func (export "test")
   652        (memory.init 0 (i64.const 1) (i64.const 1) (f64.const 1))))
   653    "type mismatch")
   654  
   655  (assert_invalid
   656    (module
   657      (memory 1)
   658      (data "\37")
   659      (func (export "test")
   660        (memory.init 0 (i64.const 1) (f64.const 1) (i32.const 1))))
   661    "type mismatch")
   662  
   663  (assert_invalid
   664    (module
   665      (memory 1)
   666      (data "\37")
   667      (func (export "test")
   668        (memory.init 0 (i64.const 1) (f64.const 1) (f32.const 1))))
   669    "type mismatch")
   670  
   671  (assert_invalid
   672    (module
   673      (memory 1)
   674      (data "\37")
   675      (func (export "test")
   676        (memory.init 0 (i64.const 1) (f64.const 1) (i64.const 1))))
   677    "type mismatch")
   678  
   679  (assert_invalid
   680    (module
   681      (memory 1)
   682      (data "\37")
   683      (func (export "test")
   684        (memory.init 0 (i64.const 1) (f64.const 1) (f64.const 1))))
   685    "type mismatch")
   686  
   687  (assert_invalid
   688    (module
   689      (memory 1)
   690      (data "\37")
   691      (func (export "test")
   692        (memory.init 0 (f64.const 1) (i32.const 1) (i32.const 1))))
   693    "type mismatch")
   694  
   695  (assert_invalid
   696    (module
   697      (memory 1)
   698      (data "\37")
   699      (func (export "test")
   700        (memory.init 0 (f64.const 1) (i32.const 1) (f32.const 1))))
   701    "type mismatch")
   702  
   703  (assert_invalid
   704    (module
   705      (memory 1)
   706      (data "\37")
   707      (func (export "test")
   708        (memory.init 0 (f64.const 1) (i32.const 1) (i64.const 1))))
   709    "type mismatch")
   710  
   711  (assert_invalid
   712    (module
   713      (memory 1)
   714      (data "\37")
   715      (func (export "test")
   716        (memory.init 0 (f64.const 1) (i32.const 1) (f64.const 1))))
   717    "type mismatch")
   718  
   719  (assert_invalid
   720    (module
   721      (memory 1)
   722      (data "\37")
   723      (func (export "test")
   724        (memory.init 0 (f64.const 1) (f32.const 1) (i32.const 1))))
   725    "type mismatch")
   726  
   727  (assert_invalid
   728    (module
   729      (memory 1)
   730      (data "\37")
   731      (func (export "test")
   732        (memory.init 0 (f64.const 1) (f32.const 1) (f32.const 1))))
   733    "type mismatch")
   734  
   735  (assert_invalid
   736    (module
   737      (memory 1)
   738      (data "\37")
   739      (func (export "test")
   740        (memory.init 0 (f64.const 1) (f32.const 1) (i64.const 1))))
   741    "type mismatch")
   742  
   743  (assert_invalid
   744    (module
   745      (memory 1)
   746      (data "\37")
   747      (func (export "test")
   748        (memory.init 0 (f64.const 1) (f32.const 1) (f64.const 1))))
   749    "type mismatch")
   750  
   751  (assert_invalid
   752    (module
   753      (memory 1)
   754      (data "\37")
   755      (func (export "test")
   756        (memory.init 0 (f64.const 1) (i64.const 1) (i32.const 1))))
   757    "type mismatch")
   758  
   759  (assert_invalid
   760    (module
   761      (memory 1)
   762      (data "\37")
   763      (func (export "test")
   764        (memory.init 0 (f64.const 1) (i64.const 1) (f32.const 1))))
   765    "type mismatch")
   766  
   767  (assert_invalid
   768    (module
   769      (memory 1)
   770      (data "\37")
   771      (func (export "test")
   772        (memory.init 0 (f64.const 1) (i64.const 1) (i64.const 1))))
   773    "type mismatch")
   774  
   775  (assert_invalid
   776    (module
   777      (memory 1)
   778      (data "\37")
   779      (func (export "test")
   780        (memory.init 0 (f64.const 1) (i64.const 1) (f64.const 1))))
   781    "type mismatch")
   782  
   783  (assert_invalid
   784    (module
   785      (memory 1)
   786      (data "\37")
   787      (func (export "test")
   788        (memory.init 0 (f64.const 1) (f64.const 1) (i32.const 1))))
   789    "type mismatch")
   790  
   791  (assert_invalid
   792    (module
   793      (memory 1)
   794      (data "\37")
   795      (func (export "test")
   796        (memory.init 0 (f64.const 1) (f64.const 1) (f32.const 1))))
   797    "type mismatch")
   798  
   799  (assert_invalid
   800    (module
   801      (memory 1)
   802      (data "\37")
   803      (func (export "test")
   804        (memory.init 0 (f64.const 1) (f64.const 1) (i64.const 1))))
   805    "type mismatch")
   806  
   807  (assert_invalid
   808    (module
   809      (memory 1)
   810      (data "\37")
   811      (func (export "test")
   812        (memory.init 0 (f64.const 1) (f64.const 1) (f64.const 1))))
   813    "type mismatch")
   814  
   815  (module
   816    (memory 1 1 )
   817    (data "\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42")
   818     
   819    (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
   820      (loop $cont
   821        (if (i32.eq (local.get $from) (local.get $to))
   822          (then
   823            (return (i32.const -1))))
   824        (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
   825          (then
   826            (local.set $from (i32.add (local.get $from) (i32.const 1)))
   827            (br $cont))))
   828      (return (local.get $from)))
   829  
   830    (func (export "run") (param $offs i32) (param $len i32)
   831      (memory.init 0 (local.get $offs) (i32.const 0) (local.get $len))))
   832  
   833  (assert_trap (invoke "run" (i32.const 65528) (i32.const 16))
   834                "out of bounds memory access")
   835  
   836  (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
   837                 (i32.const -1))
   838  (module
   839    (memory 1 1 )
   840    (data "\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42")
   841     
   842    (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
   843      (loop $cont
   844        (if (i32.eq (local.get $from) (local.get $to))
   845          (then
   846            (return (i32.const -1))))
   847        (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
   848          (then
   849            (local.set $from (i32.add (local.get $from) (i32.const 1)))
   850            (br $cont))))
   851      (return (local.get $from)))
   852  
   853    (func (export "run") (param $offs i32) (param $len i32)
   854      (memory.init 0 (local.get $offs) (i32.const 0) (local.get $len))))
   855  
   856  (assert_trap (invoke "run" (i32.const 65527) (i32.const 16))
   857                "out of bounds memory access")
   858  
   859  (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
   860                 (i32.const -1))
   861  (module
   862    (memory 1 1 )
   863    (data "\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42")
   864     
   865    (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
   866      (loop $cont
   867        (if (i32.eq (local.get $from) (local.get $to))
   868          (then
   869            (return (i32.const -1))))
   870        (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
   871          (then
   872            (local.set $from (i32.add (local.get $from) (i32.const 1)))
   873            (br $cont))))
   874      (return (local.get $from)))
   875  
   876    (func (export "run") (param $offs i32) (param $len i32)
   877      (memory.init 0 (local.get $offs) (i32.const 0) (local.get $len))))
   878  
   879  (assert_trap (invoke "run" (i32.const 65472) (i32.const 30))
   880                "out of bounds memory access")
   881  
   882  (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
   883                 (i32.const -1))
   884  (module
   885    (memory 1 1 )
   886    (data "\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42")
   887     
   888    (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
   889      (loop $cont
   890        (if (i32.eq (local.get $from) (local.get $to))
   891          (then
   892            (return (i32.const -1))))
   893        (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
   894          (then
   895            (local.set $from (i32.add (local.get $from) (i32.const 1)))
   896            (br $cont))))
   897      (return (local.get $from)))
   898  
   899    (func (export "run") (param $offs i32) (param $len i32)
   900      (memory.init 0 (local.get $offs) (i32.const 0) (local.get $len))))
   901  
   902  (assert_trap (invoke "run" (i32.const 65473) (i32.const 31))
   903                "out of bounds memory access")
   904  
   905  (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
   906                 (i32.const -1))
   907  (module
   908    (memory 1  )
   909    (data "\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42")
   910     
   911    (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
   912      (loop $cont
   913        (if (i32.eq (local.get $from) (local.get $to))
   914          (then
   915            (return (i32.const -1))))
   916        (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
   917          (then
   918            (local.set $from (i32.add (local.get $from) (i32.const 1)))
   919            (br $cont))))
   920      (return (local.get $from)))
   921  
   922    (func (export "run") (param $offs i32) (param $len i32)
   923      (memory.init 0 (local.get $offs) (i32.const 0) (local.get $len))))
   924  
   925  (assert_trap (invoke "run" (i32.const 65528) (i32.const 4294967040))
   926                "out of bounds memory access")
   927  
   928  (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
   929                 (i32.const -1))
   930  (module
   931    (memory 1  )
   932    (data "\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42\42")
   933     
   934    (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
   935      (loop $cont
   936        (if (i32.eq (local.get $from) (local.get $to))
   937          (then
   938            (return (i32.const -1))))
   939        (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
   940          (then
   941            (local.set $from (i32.add (local.get $from) (i32.const 1)))
   942            (br $cont))))
   943      (return (local.get $from)))
   944  
   945    (func (export "run") (param $offs i32) (param $len i32)
   946      (memory.init 0 (local.get $offs) (i32.const 0) (local.get $len))))
   947  
   948  (assert_trap (invoke "run" (i32.const 0) (i32.const 4294967292))
   949                "out of bounds memory access")
   950  
   951  (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
   952                 (i32.const -1))
   953  
   954  (module
   955    (memory 1)
   956    ;; 65 data segments. 64 is the smallest positive number that is encoded
   957    ;; differently as a signed LEB.
   958    (data "") (data "") (data "") (data "") (data "") (data "") (data "") (data "")
   959    (data "") (data "") (data "") (data "") (data "") (data "") (data "") (data "")
   960    (data "") (data "") (data "") (data "") (data "") (data "") (data "") (data "")
   961    (data "") (data "") (data "") (data "") (data "") (data "") (data "") (data "")
   962    (data "") (data "") (data "") (data "") (data "") (data "") (data "") (data "")
   963    (data "") (data "") (data "") (data "") (data "") (data "") (data "") (data "")
   964    (data "") (data "") (data "") (data "") (data "") (data "") (data "") (data "")
   965    (data "") (data "") (data "") (data "") (data "") (data "") (data "") (data "")
   966    (data "")
   967    (func (memory.init 64 (i32.const 0) (i32.const 0) (i32.const 0))))