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

     1  ;; Load i32 data with different offset/align arguments
     2  
     3  (module
     4    (memory 1)
     5    (data (i32.const 0) "abcdefghijklmnopqrstuvwxyz")
     6  
     7    (func (export "8u_good1") (param $i i32) (result i32)
     8      (i32.load8_u offset=0 (local.get $i))                   ;; 97 'a'
     9    )
    10    (func (export "8u_good2") (param $i i32) (result i32)
    11      (i32.load8_u align=1 (local.get $i))                    ;; 97 'a'
    12    )
    13    (func (export "8u_good3") (param $i i32) (result i32)
    14      (i32.load8_u offset=1 align=1 (local.get $i))           ;; 98 'b'
    15    )
    16    (func (export "8u_good4") (param $i i32) (result i32)
    17      (i32.load8_u offset=2 align=1 (local.get $i))           ;; 99 'c'
    18    )
    19    (func (export "8u_good5") (param $i i32) (result i32)
    20      (i32.load8_u offset=25 align=1 (local.get $i))          ;; 122 'z'
    21    )
    22  
    23    (func (export "8s_good1") (param $i i32) (result i32)
    24      (i32.load8_s offset=0 (local.get $i))                   ;; 97 'a'
    25    )
    26    (func (export "8s_good2") (param $i i32) (result i32)
    27      (i32.load8_s align=1 (local.get $i))                    ;; 97 'a'
    28    )
    29    (func (export "8s_good3") (param $i i32) (result i32)
    30      (i32.load8_s offset=1 align=1 (local.get $i))           ;; 98 'b'
    31    )
    32    (func (export "8s_good4") (param $i i32) (result i32)
    33      (i32.load8_s offset=2 align=1 (local.get $i))           ;; 99 'c'
    34    )
    35    (func (export "8s_good5") (param $i i32) (result i32)
    36      (i32.load8_s offset=25 align=1 (local.get $i))          ;; 122 'z'
    37    )
    38  
    39    (func (export "16u_good1") (param $i i32) (result i32)
    40      (i32.load16_u offset=0 (local.get $i))                  ;; 25185 'ab'
    41    )
    42    (func (export "16u_good2") (param $i i32) (result i32)
    43      (i32.load16_u align=1 (local.get $i))                   ;; 25185 'ab'
    44    )
    45    (func (export "16u_good3") (param $i i32) (result i32)
    46      (i32.load16_u offset=1 align=1 (local.get $i))          ;; 25442 'bc'
    47    )
    48    (func (export "16u_good4") (param $i i32) (result i32)
    49      (i32.load16_u offset=2 align=2 (local.get $i))          ;; 25699 'cd'
    50    )
    51    (func (export "16u_good5") (param $i i32) (result i32)
    52      (i32.load16_u offset=25 align=2 (local.get $i))         ;; 122 'z\0'
    53    )
    54  
    55    (func (export "16s_good1") (param $i i32) (result i32)
    56      (i32.load16_s offset=0 (local.get $i))                  ;; 25185 'ab'
    57    )
    58    (func (export "16s_good2") (param $i i32) (result i32)
    59      (i32.load16_s align=1 (local.get $i))                   ;; 25185 'ab'
    60    )
    61    (func (export "16s_good3") (param $i i32) (result i32)
    62      (i32.load16_s offset=1 align=1 (local.get $i))          ;; 25442 'bc'
    63    )
    64    (func (export "16s_good4") (param $i i32) (result i32)
    65      (i32.load16_s offset=2 align=2 (local.get $i))          ;; 25699 'cd'
    66    )
    67    (func (export "16s_good5") (param $i i32) (result i32)
    68      (i32.load16_s offset=25 align=2 (local.get $i))         ;; 122 'z\0'
    69    )
    70  
    71    (func (export "32_good1") (param $i i32) (result i32)
    72      (i32.load offset=0 (local.get $i))                      ;; 1684234849 'abcd'
    73    )
    74    (func (export "32_good2") (param $i i32) (result i32)
    75      (i32.load align=1 (local.get $i))                       ;; 1684234849 'abcd'
    76    )
    77    (func (export "32_good3") (param $i i32) (result i32)
    78      (i32.load offset=1 align=1 (local.get $i))              ;; 1701077858 'bcde'
    79    )
    80    (func (export "32_good4") (param $i i32) (result i32)
    81      (i32.load offset=2 align=2 (local.get $i))              ;; 1717920867 'cdef'
    82    )
    83    (func (export "32_good5") (param $i i32) (result i32)
    84      (i32.load offset=25 align=4 (local.get $i))             ;; 122 'z\0\0\0'
    85    )
    86  
    87    (func (export "8u_bad") (param $i i32)
    88      (drop (i32.load8_u offset=4294967295 (local.get $i)))
    89    )
    90    (func (export "8s_bad") (param $i i32)
    91      (drop (i32.load8_s offset=4294967295 (local.get $i)))
    92    )
    93    (func (export "16u_bad") (param $i i32)
    94      (drop (i32.load16_u offset=4294967295 (local.get $i)))
    95    )
    96    (func (export "16s_bad") (param $i i32)
    97      (drop (i32.load16_s offset=4294967295 (local.get $i)))
    98    )
    99    (func (export "32_bad") (param $i i32)
   100      (drop (i32.load offset=4294967295 (local.get $i)))
   101    )
   102  )
   103  
   104  (assert_return (invoke "8u_good1" (i32.const 0)) (i32.const 97))
   105  (assert_return (invoke "8u_good2" (i32.const 0)) (i32.const 97))
   106  (assert_return (invoke "8u_good3" (i32.const 0)) (i32.const 98))
   107  (assert_return (invoke "8u_good4" (i32.const 0)) (i32.const 99))
   108  (assert_return (invoke "8u_good5" (i32.const 0)) (i32.const 122))
   109  
   110  (assert_return (invoke "8s_good1" (i32.const 0)) (i32.const 97))
   111  (assert_return (invoke "8s_good2" (i32.const 0)) (i32.const 97))
   112  (assert_return (invoke "8s_good3" (i32.const 0)) (i32.const 98))
   113  (assert_return (invoke "8s_good4" (i32.const 0)) (i32.const 99))
   114  (assert_return (invoke "8s_good5" (i32.const 0)) (i32.const 122))
   115  
   116  (assert_return (invoke "16u_good1" (i32.const 0)) (i32.const 25185))
   117  (assert_return (invoke "16u_good2" (i32.const 0)) (i32.const 25185))
   118  (assert_return (invoke "16u_good3" (i32.const 0)) (i32.const 25442))
   119  (assert_return (invoke "16u_good4" (i32.const 0)) (i32.const 25699))
   120  (assert_return (invoke "16u_good5" (i32.const 0)) (i32.const 122))
   121  
   122  (assert_return (invoke "16s_good1" (i32.const 0)) (i32.const 25185))
   123  (assert_return (invoke "16s_good2" (i32.const 0)) (i32.const 25185))
   124  (assert_return (invoke "16s_good3" (i32.const 0)) (i32.const 25442))
   125  (assert_return (invoke "16s_good4" (i32.const 0)) (i32.const 25699))
   126  (assert_return (invoke "16s_good5" (i32.const 0)) (i32.const 122))
   127  
   128  (assert_return (invoke "32_good1" (i32.const 0)) (i32.const 1684234849))
   129  (assert_return (invoke "32_good2" (i32.const 0)) (i32.const 1684234849))
   130  (assert_return (invoke "32_good3" (i32.const 0)) (i32.const 1701077858))
   131  (assert_return (invoke "32_good4" (i32.const 0)) (i32.const 1717920867))
   132  (assert_return (invoke "32_good5" (i32.const 0)) (i32.const 122))
   133  
   134  (assert_return (invoke "8u_good1" (i32.const 65507)) (i32.const 0))
   135  (assert_return (invoke "8u_good2" (i32.const 65507)) (i32.const 0))
   136  (assert_return (invoke "8u_good3" (i32.const 65507)) (i32.const 0))
   137  (assert_return (invoke "8u_good4" (i32.const 65507)) (i32.const 0))
   138  (assert_return (invoke "8u_good5" (i32.const 65507)) (i32.const 0))
   139  
   140  (assert_return (invoke "8s_good1" (i32.const 65507)) (i32.const 0))
   141  (assert_return (invoke "8s_good2" (i32.const 65507)) (i32.const 0))
   142  (assert_return (invoke "8s_good3" (i32.const 65507)) (i32.const 0))
   143  (assert_return (invoke "8s_good4" (i32.const 65507)) (i32.const 0))
   144  (assert_return (invoke "8s_good5" (i32.const 65507)) (i32.const 0))
   145  
   146  (assert_return (invoke "16u_good1" (i32.const 65507)) (i32.const 0))
   147  (assert_return (invoke "16u_good2" (i32.const 65507)) (i32.const 0))
   148  (assert_return (invoke "16u_good3" (i32.const 65507)) (i32.const 0))
   149  (assert_return (invoke "16u_good4" (i32.const 65507)) (i32.const 0))
   150  (assert_return (invoke "16u_good5" (i32.const 65507)) (i32.const 0))
   151  
   152  (assert_return (invoke "16s_good1" (i32.const 65507)) (i32.const 0))
   153  (assert_return (invoke "16s_good2" (i32.const 65507)) (i32.const 0))
   154  (assert_return (invoke "16s_good3" (i32.const 65507)) (i32.const 0))
   155  (assert_return (invoke "16s_good4" (i32.const 65507)) (i32.const 0))
   156  (assert_return (invoke "16s_good5" (i32.const 65507)) (i32.const 0))
   157  
   158  (assert_return (invoke "32_good1" (i32.const 65507)) (i32.const 0))
   159  (assert_return (invoke "32_good2" (i32.const 65507)) (i32.const 0))
   160  (assert_return (invoke "32_good3" (i32.const 65507)) (i32.const 0))
   161  (assert_return (invoke "32_good4" (i32.const 65507)) (i32.const 0))
   162  (assert_return (invoke "32_good5" (i32.const 65507)) (i32.const 0))
   163  
   164  (assert_return (invoke "8u_good1" (i32.const 65508)) (i32.const 0))
   165  (assert_return (invoke "8u_good2" (i32.const 65508)) (i32.const 0))
   166  (assert_return (invoke "8u_good3" (i32.const 65508)) (i32.const 0))
   167  (assert_return (invoke "8u_good4" (i32.const 65508)) (i32.const 0))
   168  (assert_return (invoke "8u_good5" (i32.const 65508)) (i32.const 0))
   169  
   170  (assert_return (invoke "8s_good1" (i32.const 65508)) (i32.const 0))
   171  (assert_return (invoke "8s_good2" (i32.const 65508)) (i32.const 0))
   172  (assert_return (invoke "8s_good3" (i32.const 65508)) (i32.const 0))
   173  (assert_return (invoke "8s_good4" (i32.const 65508)) (i32.const 0))
   174  (assert_return (invoke "8s_good5" (i32.const 65508)) (i32.const 0))
   175  
   176  (assert_return (invoke "16u_good1" (i32.const 65508)) (i32.const 0))
   177  (assert_return (invoke "16u_good2" (i32.const 65508)) (i32.const 0))
   178  (assert_return (invoke "16u_good3" (i32.const 65508)) (i32.const 0))
   179  (assert_return (invoke "16u_good4" (i32.const 65508)) (i32.const 0))
   180  (assert_return (invoke "16u_good5" (i32.const 65508)) (i32.const 0))
   181  
   182  (assert_return (invoke "16s_good1" (i32.const 65508)) (i32.const 0))
   183  (assert_return (invoke "16s_good2" (i32.const 65508)) (i32.const 0))
   184  (assert_return (invoke "16s_good3" (i32.const 65508)) (i32.const 0))
   185  (assert_return (invoke "16s_good4" (i32.const 65508)) (i32.const 0))
   186  (assert_return (invoke "16s_good5" (i32.const 65508)) (i32.const 0))
   187  
   188  (assert_return (invoke "32_good1" (i32.const 65508)) (i32.const 0))
   189  (assert_return (invoke "32_good2" (i32.const 65508)) (i32.const 0))
   190  (assert_return (invoke "32_good3" (i32.const 65508)) (i32.const 0))
   191  (assert_return (invoke "32_good4" (i32.const 65508)) (i32.const 0))
   192  (assert_trap (invoke "32_good5" (i32.const 65508)) "out of bounds memory access")
   193  
   194  (assert_trap (invoke "8u_good3" (i32.const -1)) "out of bounds memory access")
   195  (assert_trap (invoke "8s_good3" (i32.const -1)) "out of bounds memory access")
   196  (assert_trap (invoke "16u_good3" (i32.const -1)) "out of bounds memory access")
   197  (assert_trap (invoke "16s_good3" (i32.const -1)) "out of bounds memory access")
   198  (assert_trap (invoke "32_good3" (i32.const -1)) "out of bounds memory access")
   199  (assert_trap (invoke "32_good3" (i32.const -1)) "out of bounds memory access")
   200  
   201  (assert_trap (invoke "8u_bad" (i32.const 0)) "out of bounds memory access")
   202  (assert_trap (invoke "8s_bad" (i32.const 0)) "out of bounds memory access")
   203  (assert_trap (invoke "16u_bad" (i32.const 0)) "out of bounds memory access")
   204  (assert_trap (invoke "16s_bad" (i32.const 0)) "out of bounds memory access")
   205  (assert_trap (invoke "32_bad" (i32.const 0)) "out of bounds memory access")
   206  
   207  (assert_trap (invoke "8u_bad" (i32.const 1)) "out of bounds memory access")
   208  (assert_trap (invoke "8s_bad" (i32.const 1)) "out of bounds memory access")
   209  (assert_trap (invoke "16u_bad" (i32.const 1)) "out of bounds memory access")
   210  (assert_trap (invoke "16s_bad" (i32.const 1)) "out of bounds memory access")
   211  (assert_trap (invoke "32_bad" (i32.const 1)) "out of bounds memory access")
   212  
   213  (assert_malformed
   214    (module quote
   215      "(memory 1)"
   216      "(func (drop (i32.load offset=4294967296 (i32.const 0))))"
   217    )
   218    "i32 constant"
   219  )
   220  
   221  ;; Load i64 data with different offset/align arguments
   222  
   223  (module
   224    (memory 1)
   225    (data (i32.const 0) "abcdefghijklmnopqrstuvwxyz")
   226  
   227    (func (export "8u_good1") (param $i i32) (result i64)
   228      (i64.load8_u offset=0 (local.get $i))                   ;; 97 'a'
   229    )
   230    (func (export "8u_good2") (param $i i32) (result i64)
   231      (i64.load8_u align=1 (local.get $i))                    ;; 97 'a'
   232    )
   233    (func (export "8u_good3") (param $i i32) (result i64)
   234      (i64.load8_u offset=1 align=1 (local.get $i))           ;; 98 'b'
   235    )
   236    (func (export "8u_good4") (param $i i32) (result i64)
   237      (i64.load8_u offset=2 align=1 (local.get $i))           ;; 99 'c'
   238    )
   239    (func (export "8u_good5") (param $i i32) (result i64)
   240      (i64.load8_u offset=25 align=1 (local.get $i))          ;; 122 'z'
   241    )
   242  
   243    (func (export "8s_good1") (param $i i32) (result i64)
   244      (i64.load8_s offset=0 (local.get $i))                   ;; 97 'a'
   245    )
   246    (func (export "8s_good2") (param $i i32) (result i64)
   247      (i64.load8_s align=1 (local.get $i))                    ;; 97 'a'
   248    )
   249    (func (export "8s_good3") (param $i i32) (result i64)
   250      (i64.load8_s offset=1 align=1 (local.get $i))           ;; 98 'b'
   251    )
   252    (func (export "8s_good4") (param $i i32) (result i64)
   253      (i64.load8_s offset=2 align=1 (local.get $i))           ;; 99 'c'
   254    )
   255    (func (export "8s_good5") (param $i i32) (result i64)
   256      (i64.load8_s offset=25 align=1 (local.get $i))          ;; 122 'z'
   257    )
   258  
   259    (func (export "16u_good1") (param $i i32) (result i64)
   260      (i64.load16_u offset=0 (local.get $i))                 ;; 25185 'ab'
   261    )
   262    (func (export "16u_good2") (param $i i32) (result i64)
   263      (i64.load16_u align=1 (local.get $i))                  ;; 25185 'ab'
   264    )
   265    (func (export "16u_good3") (param $i i32) (result i64)
   266      (i64.load16_u offset=1 align=1 (local.get $i))         ;; 25442 'bc'
   267    )
   268    (func (export "16u_good4") (param $i i32) (result i64)
   269      (i64.load16_u offset=2 align=2 (local.get $i))         ;; 25699 'cd'
   270    )
   271    (func (export "16u_good5") (param $i i32) (result i64)
   272      (i64.load16_u offset=25 align=2 (local.get $i))        ;; 122 'z\0'
   273    )
   274  
   275    (func (export "16s_good1") (param $i i32) (result i64)
   276      (i64.load16_s offset=0 (local.get $i))                 ;; 25185 'ab'
   277    )
   278    (func (export "16s_good2") (param $i i32) (result i64)
   279      (i64.load16_s align=1 (local.get $i))                  ;; 25185 'ab'
   280    )
   281    (func (export "16s_good3") (param $i i32) (result i64)
   282      (i64.load16_s offset=1 align=1 (local.get $i))         ;; 25442 'bc'
   283    )
   284    (func (export "16s_good4") (param $i i32) (result i64)
   285      (i64.load16_s offset=2 align=2 (local.get $i))         ;; 25699 'cd'
   286    )
   287    (func (export "16s_good5") (param $i i32) (result i64)
   288      (i64.load16_s offset=25 align=2 (local.get $i))        ;; 122 'z\0'
   289    )
   290  
   291    (func (export "32u_good1") (param $i i32) (result i64)
   292      (i64.load32_u offset=0 (local.get $i))                 ;; 1684234849 'abcd'
   293    )
   294    (func (export "32u_good2") (param $i i32) (result i64)
   295      (i64.load32_u align=1 (local.get $i))                  ;; 1684234849 'abcd'
   296    )
   297    (func (export "32u_good3") (param $i i32) (result i64)
   298      (i64.load32_u offset=1 align=1 (local.get $i))         ;; 1701077858 'bcde'
   299    )
   300    (func (export "32u_good4") (param $i i32) (result i64)
   301      (i64.load32_u offset=2 align=2 (local.get $i))         ;; 1717920867 'cdef'
   302    )
   303    (func (export "32u_good5") (param $i i32) (result i64)
   304      (i64.load32_u offset=25 align=4 (local.get $i))        ;; 122 'z\0\0\0'
   305    )
   306  
   307    (func (export "32s_good1") (param $i i32) (result i64)
   308      (i64.load32_s offset=0 (local.get $i))                 ;; 1684234849 'abcd'
   309    )
   310    (func (export "32s_good2") (param $i i32) (result i64)
   311      (i64.load32_s align=1 (local.get $i))                  ;; 1684234849 'abcd'
   312    )
   313    (func (export "32s_good3") (param $i i32) (result i64)
   314      (i64.load32_s offset=1 align=1 (local.get $i))         ;; 1701077858 'bcde'
   315    )
   316    (func (export "32s_good4") (param $i i32) (result i64)
   317      (i64.load32_s offset=2 align=2 (local.get $i))         ;; 1717920867 'cdef'
   318    )
   319    (func (export "32s_good5") (param $i i32) (result i64)
   320      (i64.load32_s offset=25 align=4 (local.get $i))        ;; 122 'z\0\0\0'
   321    )
   322  
   323    (func (export "64_good1") (param $i i32) (result i64)
   324      (i64.load offset=0 (local.get $i))                     ;; 0x6867666564636261 'abcdefgh'
   325    )
   326    (func (export "64_good2") (param $i i32) (result i64)
   327      (i64.load align=1 (local.get $i))                      ;; 0x6867666564636261 'abcdefgh'
   328    )
   329    (func (export "64_good3") (param $i i32) (result i64)
   330      (i64.load offset=1 align=1 (local.get $i))             ;; 0x6968676665646362 'bcdefghi'
   331    )
   332    (func (export "64_good4") (param $i i32) (result i64)
   333      (i64.load offset=2 align=2 (local.get $i))             ;; 0x6a69686766656463 'cdefghij'
   334    )
   335    (func (export "64_good5") (param $i i32) (result i64)
   336      (i64.load offset=25 align=8 (local.get $i))            ;; 122 'z\0\0\0\0\0\0\0'
   337    )
   338  
   339    (func (export "8u_bad") (param $i i32)
   340      (drop (i64.load8_u offset=4294967295 (local.get $i)))
   341    )
   342    (func (export "8s_bad") (param $i i32)
   343      (drop (i64.load8_s offset=4294967295 (local.get $i)))
   344    )
   345    (func (export "16u_bad") (param $i i32)
   346      (drop (i64.load16_u offset=4294967295 (local.get $i)))
   347    )
   348    (func (export "16s_bad") (param $i i32)
   349      (drop (i64.load16_s offset=4294967295 (local.get $i)))
   350    )
   351    (func (export "32u_bad") (param $i i32)
   352      (drop (i64.load32_u offset=4294967295 (local.get $i)))
   353    )
   354    (func (export "32s_bad") (param $i i32)
   355      (drop (i64.load32_s offset=4294967295 (local.get $i)))
   356    )
   357    (func (export "64_bad") (param $i i32)
   358      (drop (i64.load offset=4294967295 (local.get $i)))
   359    )
   360  )
   361  
   362  (assert_return (invoke "8u_good1" (i32.const 0)) (i64.const 97))
   363  (assert_return (invoke "8u_good2" (i32.const 0)) (i64.const 97))
   364  (assert_return (invoke "8u_good3" (i32.const 0)) (i64.const 98))
   365  (assert_return (invoke "8u_good4" (i32.const 0)) (i64.const 99))
   366  (assert_return (invoke "8u_good5" (i32.const 0)) (i64.const 122))
   367  
   368  (assert_return (invoke "8s_good1" (i32.const 0)) (i64.const 97))
   369  (assert_return (invoke "8s_good2" (i32.const 0)) (i64.const 97))
   370  (assert_return (invoke "8s_good3" (i32.const 0)) (i64.const 98))
   371  (assert_return (invoke "8s_good4" (i32.const 0)) (i64.const 99))
   372  (assert_return (invoke "8s_good5" (i32.const 0)) (i64.const 122))
   373  
   374  (assert_return (invoke "16u_good1" (i32.const 0)) (i64.const 25185))
   375  (assert_return (invoke "16u_good2" (i32.const 0)) (i64.const 25185))
   376  (assert_return (invoke "16u_good3" (i32.const 0)) (i64.const 25442))
   377  (assert_return (invoke "16u_good4" (i32.const 0)) (i64.const 25699))
   378  (assert_return (invoke "16u_good5" (i32.const 0)) (i64.const 122))
   379  
   380  (assert_return (invoke "16s_good1" (i32.const 0)) (i64.const 25185))
   381  (assert_return (invoke "16s_good2" (i32.const 0)) (i64.const 25185))
   382  (assert_return (invoke "16s_good3" (i32.const 0)) (i64.const 25442))
   383  (assert_return (invoke "16s_good4" (i32.const 0)) (i64.const 25699))
   384  (assert_return (invoke "16s_good5" (i32.const 0)) (i64.const 122))
   385  
   386  (assert_return (invoke "32u_good1" (i32.const 0)) (i64.const 1684234849))
   387  (assert_return (invoke "32u_good2" (i32.const 0)) (i64.const 1684234849))
   388  (assert_return (invoke "32u_good3" (i32.const 0)) (i64.const 1701077858))
   389  (assert_return (invoke "32u_good4" (i32.const 0)) (i64.const 1717920867))
   390  (assert_return (invoke "32u_good5" (i32.const 0)) (i64.const 122))
   391  
   392  (assert_return (invoke "32s_good1" (i32.const 0)) (i64.const 1684234849))
   393  (assert_return (invoke "32s_good2" (i32.const 0)) (i64.const 1684234849))
   394  (assert_return (invoke "32s_good3" (i32.const 0)) (i64.const 1701077858))
   395  (assert_return (invoke "32s_good4" (i32.const 0)) (i64.const 1717920867))
   396  (assert_return (invoke "32s_good5" (i32.const 0)) (i64.const 122))
   397  
   398  (assert_return (invoke "64_good1" (i32.const 0)) (i64.const 0x6867666564636261))
   399  (assert_return (invoke "64_good2" (i32.const 0)) (i64.const 0x6867666564636261))
   400  (assert_return (invoke "64_good3" (i32.const 0)) (i64.const 0x6968676665646362))
   401  (assert_return (invoke "64_good4" (i32.const 0)) (i64.const 0x6a69686766656463))
   402  (assert_return (invoke "64_good5" (i32.const 0)) (i64.const 122))
   403  
   404  (assert_return (invoke "8u_good1" (i32.const 65503)) (i64.const 0))
   405  (assert_return (invoke "8u_good2" (i32.const 65503)) (i64.const 0))
   406  (assert_return (invoke "8u_good3" (i32.const 65503)) (i64.const 0))
   407  (assert_return (invoke "8u_good4" (i32.const 65503)) (i64.const 0))
   408  (assert_return (invoke "8u_good5" (i32.const 65503)) (i64.const 0))
   409  
   410  (assert_return (invoke "8s_good1" (i32.const 65503)) (i64.const 0))
   411  (assert_return (invoke "8s_good2" (i32.const 65503)) (i64.const 0))
   412  (assert_return (invoke "8s_good3" (i32.const 65503)) (i64.const 0))
   413  (assert_return (invoke "8s_good4" (i32.const 65503)) (i64.const 0))
   414  (assert_return (invoke "8s_good5" (i32.const 65503)) (i64.const 0))
   415  
   416  (assert_return (invoke "16u_good1" (i32.const 65503)) (i64.const 0))
   417  (assert_return (invoke "16u_good2" (i32.const 65503)) (i64.const 0))
   418  (assert_return (invoke "16u_good3" (i32.const 65503)) (i64.const 0))
   419  (assert_return (invoke "16u_good4" (i32.const 65503)) (i64.const 0))
   420  (assert_return (invoke "16u_good5" (i32.const 65503)) (i64.const 0))
   421  
   422  (assert_return (invoke "16s_good1" (i32.const 65503)) (i64.const 0))
   423  (assert_return (invoke "16s_good2" (i32.const 65503)) (i64.const 0))
   424  (assert_return (invoke "16s_good3" (i32.const 65503)) (i64.const 0))
   425  (assert_return (invoke "16s_good4" (i32.const 65503)) (i64.const 0))
   426  (assert_return (invoke "16s_good5" (i32.const 65503)) (i64.const 0))
   427  
   428  (assert_return (invoke "32u_good1" (i32.const 65503)) (i64.const 0))
   429  (assert_return (invoke "32u_good2" (i32.const 65503)) (i64.const 0))
   430  (assert_return (invoke "32u_good3" (i32.const 65503)) (i64.const 0))
   431  (assert_return (invoke "32u_good4" (i32.const 65503)) (i64.const 0))
   432  (assert_return (invoke "32u_good5" (i32.const 65503)) (i64.const 0))
   433  
   434  (assert_return (invoke "32s_good1" (i32.const 65503)) (i64.const 0))
   435  (assert_return (invoke "32s_good2" (i32.const 65503)) (i64.const 0))
   436  (assert_return (invoke "32s_good3" (i32.const 65503)) (i64.const 0))
   437  (assert_return (invoke "32s_good4" (i32.const 65503)) (i64.const 0))
   438  (assert_return (invoke "32s_good5" (i32.const 65503)) (i64.const 0))
   439  
   440  (assert_return (invoke "64_good1" (i32.const 65503)) (i64.const 0))
   441  (assert_return (invoke "64_good2" (i32.const 65503)) (i64.const 0))
   442  (assert_return (invoke "64_good3" (i32.const 65503)) (i64.const 0))
   443  (assert_return (invoke "64_good4" (i32.const 65503)) (i64.const 0))
   444  (assert_return (invoke "64_good5" (i32.const 65503)) (i64.const 0))
   445  
   446  (assert_return (invoke "8u_good1" (i32.const 65504)) (i64.const 0))
   447  (assert_return (invoke "8u_good2" (i32.const 65504)) (i64.const 0))
   448  (assert_return (invoke "8u_good3" (i32.const 65504)) (i64.const 0))
   449  (assert_return (invoke "8u_good4" (i32.const 65504)) (i64.const 0))
   450  (assert_return (invoke "8u_good5" (i32.const 65504)) (i64.const 0))
   451  
   452  (assert_return (invoke "8s_good1" (i32.const 65504)) (i64.const 0))
   453  (assert_return (invoke "8s_good2" (i32.const 65504)) (i64.const 0))
   454  (assert_return (invoke "8s_good3" (i32.const 65504)) (i64.const 0))
   455  (assert_return (invoke "8s_good4" (i32.const 65504)) (i64.const 0))
   456  (assert_return (invoke "8s_good5" (i32.const 65504)) (i64.const 0))
   457  
   458  (assert_return (invoke "16u_good1" (i32.const 65504)) (i64.const 0))
   459  (assert_return (invoke "16u_good2" (i32.const 65504)) (i64.const 0))
   460  (assert_return (invoke "16u_good3" (i32.const 65504)) (i64.const 0))
   461  (assert_return (invoke "16u_good4" (i32.const 65504)) (i64.const 0))
   462  (assert_return (invoke "16u_good5" (i32.const 65504)) (i64.const 0))
   463  
   464  (assert_return (invoke "16s_good1" (i32.const 65504)) (i64.const 0))
   465  (assert_return (invoke "16s_good2" (i32.const 65504)) (i64.const 0))
   466  (assert_return (invoke "16s_good3" (i32.const 65504)) (i64.const 0))
   467  (assert_return (invoke "16s_good4" (i32.const 65504)) (i64.const 0))
   468  (assert_return (invoke "16s_good5" (i32.const 65504)) (i64.const 0))
   469  
   470  (assert_return (invoke "32u_good1" (i32.const 65504)) (i64.const 0))
   471  (assert_return (invoke "32u_good2" (i32.const 65504)) (i64.const 0))
   472  (assert_return (invoke "32u_good3" (i32.const 65504)) (i64.const 0))
   473  (assert_return (invoke "32u_good4" (i32.const 65504)) (i64.const 0))
   474  (assert_return (invoke "32u_good5" (i32.const 65504)) (i64.const 0))
   475  
   476  (assert_return (invoke "32s_good1" (i32.const 65504)) (i64.const 0))
   477  (assert_return (invoke "32s_good2" (i32.const 65504)) (i64.const 0))
   478  (assert_return (invoke "32s_good3" (i32.const 65504)) (i64.const 0))
   479  (assert_return (invoke "32s_good4" (i32.const 65504)) (i64.const 0))
   480  (assert_return (invoke "32s_good5" (i32.const 65504)) (i64.const 0))
   481  
   482  (assert_return (invoke "64_good1" (i32.const 65504)) (i64.const 0))
   483  (assert_return (invoke "64_good2" (i32.const 65504)) (i64.const 0))
   484  (assert_return (invoke "64_good3" (i32.const 65504)) (i64.const 0))
   485  (assert_return (invoke "64_good4" (i32.const 65504)) (i64.const 0))
   486  (assert_trap (invoke "64_good5" (i32.const 65504)) "out of bounds memory access")
   487  
   488  (assert_trap (invoke "8u_good3" (i32.const -1)) "out of bounds memory access")
   489  (assert_trap (invoke "8s_good3" (i32.const -1)) "out of bounds memory access")
   490  (assert_trap (invoke "16u_good3" (i32.const -1)) "out of bounds memory access")
   491  (assert_trap (invoke "16s_good3" (i32.const -1)) "out of bounds memory access")
   492  (assert_trap (invoke "32u_good3" (i32.const -1)) "out of bounds memory access")
   493  (assert_trap (invoke "32s_good3" (i32.const -1)) "out of bounds memory access")
   494  (assert_trap (invoke "64_good3" (i32.const -1)) "out of bounds memory access")
   495  
   496  (assert_trap (invoke "8u_bad" (i32.const 0)) "out of bounds memory access")
   497  (assert_trap (invoke "8s_bad" (i32.const 0)) "out of bounds memory access")
   498  (assert_trap (invoke "16u_bad" (i32.const 0)) "out of bounds memory access")
   499  (assert_trap (invoke "16s_bad" (i32.const 0)) "out of bounds memory access")
   500  (assert_trap (invoke "32u_bad" (i32.const 0)) "out of bounds memory access")
   501  (assert_trap (invoke "32s_bad" (i32.const 0)) "out of bounds memory access")
   502  (assert_trap (invoke "64_bad" (i32.const 0)) "out of bounds memory access")
   503  
   504  (assert_trap (invoke "8u_bad" (i32.const 1)) "out of bounds memory access")
   505  (assert_trap (invoke "8s_bad" (i32.const 1)) "out of bounds memory access")
   506  (assert_trap (invoke "16u_bad" (i32.const 1)) "out of bounds memory access")
   507  (assert_trap (invoke "16s_bad" (i32.const 1)) "out of bounds memory access")
   508  (assert_trap (invoke "32u_bad" (i32.const 0)) "out of bounds memory access")
   509  (assert_trap (invoke "32s_bad" (i32.const 0)) "out of bounds memory access")
   510  (assert_trap (invoke "64_bad" (i32.const 1)) "out of bounds memory access")
   511  
   512  ;; Load f32 data with different offset/align arguments
   513  
   514  (module
   515    (memory 1)
   516    (data (i32.const 0) "\00\00\00\00\00\00\a0\7f\01\00\d0\7f")
   517  
   518    (func (export "32_good1") (param $i i32) (result f32)
   519      (f32.load offset=0 (local.get $i))                   ;; 0.0 '\00\00\00\00'
   520    )
   521    (func (export "32_good2") (param $i i32) (result f32)
   522      (f32.load align=1 (local.get $i))                    ;; 0.0 '\00\00\00\00'
   523    )
   524    (func (export "32_good3") (param $i i32) (result f32)
   525      (f32.load offset=1 align=1 (local.get $i))           ;; 0.0 '\00\00\00\00'
   526    )
   527    (func (export "32_good4") (param $i i32) (result f32)
   528      (f32.load offset=2 align=2 (local.get $i))           ;; 0.0 '\00\00\00\00'
   529    )
   530    (func (export "32_good5") (param $i i32) (result f32)
   531      (f32.load offset=8 align=4 (local.get $i))           ;; nan:0x500001 '\01\00\d0\7f'
   532    )
   533    (func (export "32_bad") (param $i i32)
   534      (drop (f32.load offset=4294967295 (local.get $i)))
   535    )
   536  )
   537  
   538  (assert_return (invoke "32_good1" (i32.const 0)) (f32.const 0.0))
   539  (assert_return (invoke "32_good2" (i32.const 0)) (f32.const 0.0))
   540  (assert_return (invoke "32_good3" (i32.const 0)) (f32.const 0.0))
   541  (assert_return (invoke "32_good4" (i32.const 0)) (f32.const 0.0))
   542  (assert_return (invoke "32_good5" (i32.const 0)) (f32.const nan:0x500001))
   543  
   544  (assert_return (invoke "32_good1" (i32.const 65524)) (f32.const 0.0))
   545  (assert_return (invoke "32_good2" (i32.const 65524)) (f32.const 0.0))
   546  (assert_return (invoke "32_good3" (i32.const 65524)) (f32.const 0.0))
   547  (assert_return (invoke "32_good4" (i32.const 65524)) (f32.const 0.0))
   548  (assert_return (invoke "32_good5" (i32.const 65524)) (f32.const 0.0))
   549  
   550  (assert_return (invoke "32_good1" (i32.const 65525)) (f32.const 0.0))
   551  (assert_return (invoke "32_good2" (i32.const 65525)) (f32.const 0.0))
   552  (assert_return (invoke "32_good3" (i32.const 65525)) (f32.const 0.0))
   553  (assert_return (invoke "32_good4" (i32.const 65525)) (f32.const 0.0))
   554  (assert_trap (invoke "32_good5" (i32.const 65525)) "out of bounds memory access")
   555  
   556  (assert_trap (invoke "32_good3" (i32.const -1)) "out of bounds memory access")
   557  (assert_trap (invoke "32_good3" (i32.const -1)) "out of bounds memory access")
   558  
   559  (assert_trap (invoke "32_bad" (i32.const 0)) "out of bounds memory access")
   560  (assert_trap (invoke "32_bad" (i32.const 1)) "out of bounds memory access")
   561  
   562  ;; Load f64 data with different offset/align arguments
   563  
   564  (module
   565    (memory 1)
   566    (data (i32.const 0) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\f4\7f\01\00\00\00\00\00\fc\7f")
   567  
   568    (func (export "64_good1") (param $i i32) (result f64)
   569      (f64.load offset=0 (local.get $i))                     ;; 0.0 '\00\00\00\00\00\00\00\00'
   570    )
   571    (func (export "64_good2") (param $i i32) (result f64)
   572      (f64.load align=1 (local.get $i))                      ;; 0.0 '\00\00\00\00\00\00\00\00'
   573    )
   574    (func (export "64_good3") (param $i i32) (result f64)
   575      (f64.load offset=1 align=1 (local.get $i))             ;; 0.0 '\00\00\00\00\00\00\00\00'
   576    )
   577    (func (export "64_good4") (param $i i32) (result f64)
   578      (f64.load offset=2 align=2 (local.get $i))             ;; 0.0 '\00\00\00\00\00\00\00\00'
   579    )
   580    (func (export "64_good5") (param $i i32) (result f64)
   581      (f64.load offset=18 align=8 (local.get $i))            ;; nan:0xc000000000001 '\01\00\00\00\00\00\fc\7f'
   582    )
   583    (func (export "64_bad") (param $i i32)
   584      (drop (f64.load offset=4294967295 (local.get $i)))
   585    )
   586  )
   587  
   588  (assert_return (invoke "64_good1" (i32.const 0)) (f64.const 0.0))
   589  (assert_return (invoke "64_good2" (i32.const 0)) (f64.const 0.0))
   590  (assert_return (invoke "64_good3" (i32.const 0)) (f64.const 0.0))
   591  (assert_return (invoke "64_good4" (i32.const 0)) (f64.const 0.0))
   592  (assert_return (invoke "64_good5" (i32.const 0)) (f64.const nan:0xc000000000001))
   593  
   594  (assert_return (invoke "64_good1" (i32.const 65510)) (f64.const 0.0))
   595  (assert_return (invoke "64_good2" (i32.const 65510)) (f64.const 0.0))
   596  (assert_return (invoke "64_good3" (i32.const 65510)) (f64.const 0.0))
   597  (assert_return (invoke "64_good4" (i32.const 65510)) (f64.const 0.0))
   598  (assert_return (invoke "64_good5" (i32.const 65510)) (f64.const 0.0))
   599  
   600  (assert_return (invoke "64_good1" (i32.const 65511)) (f64.const 0.0))
   601  (assert_return (invoke "64_good2" (i32.const 65511)) (f64.const 0.0))
   602  (assert_return (invoke "64_good3" (i32.const 65511)) (f64.const 0.0))
   603  (assert_return (invoke "64_good4" (i32.const 65511)) (f64.const 0.0))
   604  (assert_trap (invoke "64_good5" (i32.const 65511)) "out of bounds memory access")
   605  
   606  (assert_trap (invoke "64_good3" (i32.const -1)) "out of bounds memory access")
   607  (assert_trap (invoke "64_good3" (i32.const -1)) "out of bounds memory access")
   608  
   609  (assert_trap (invoke "64_bad" (i32.const 0)) "out of bounds memory access")
   610  (assert_trap (invoke "64_bad" (i32.const 1)) "out of bounds memory access")