github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/integration_test/spectest/v1/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_bad" (i32.const 0)) "out of bounds memory access") 195 (assert_trap (invoke "8s_bad" (i32.const 0)) "out of bounds memory access") 196 (assert_trap (invoke "16u_bad" (i32.const 0)) "out of bounds memory access") 197 (assert_trap (invoke "16s_bad" (i32.const 0)) "out of bounds memory access") 198 (assert_trap (invoke "32_bad" (i32.const 0)) "out of bounds memory access") 199 200 (assert_trap (invoke "8u_bad" (i32.const 1)) "out of bounds memory access") 201 (assert_trap (invoke "8s_bad" (i32.const 1)) "out of bounds memory access") 202 (assert_trap (invoke "16u_bad" (i32.const 1)) "out of bounds memory access") 203 (assert_trap (invoke "16s_bad" (i32.const 1)) "out of bounds memory access") 204 (assert_trap (invoke "32_bad" (i32.const 1)) "out of bounds memory access") 205 206 (assert_malformed 207 (module quote 208 "(memory 1)" 209 "(func (drop (i32.load offset=4294967296 (i32.const 0))))" 210 ) 211 "i32 constant" 212 ) 213 214 ;; Load i64 data with different offset/align arguments 215 216 (module 217 (memory 1) 218 (data (i32.const 0) "abcdefghijklmnopqrstuvwxyz") 219 220 (func (export "8u_good1") (param $i i32) (result i64) 221 (i64.load8_u offset=0 (local.get $i)) ;; 97 'a' 222 ) 223 (func (export "8u_good2") (param $i i32) (result i64) 224 (i64.load8_u align=1 (local.get $i)) ;; 97 'a' 225 ) 226 (func (export "8u_good3") (param $i i32) (result i64) 227 (i64.load8_u offset=1 align=1 (local.get $i)) ;; 98 'b' 228 ) 229 (func (export "8u_good4") (param $i i32) (result i64) 230 (i64.load8_u offset=2 align=1 (local.get $i)) ;; 99 'c' 231 ) 232 (func (export "8u_good5") (param $i i32) (result i64) 233 (i64.load8_u offset=25 align=1 (local.get $i)) ;; 122 'z' 234 ) 235 236 (func (export "8s_good1") (param $i i32) (result i64) 237 (i64.load8_s offset=0 (local.get $i)) ;; 97 'a' 238 ) 239 (func (export "8s_good2") (param $i i32) (result i64) 240 (i64.load8_s align=1 (local.get $i)) ;; 97 'a' 241 ) 242 (func (export "8s_good3") (param $i i32) (result i64) 243 (i64.load8_s offset=1 align=1 (local.get $i)) ;; 98 'b' 244 ) 245 (func (export "8s_good4") (param $i i32) (result i64) 246 (i64.load8_s offset=2 align=1 (local.get $i)) ;; 99 'c' 247 ) 248 (func (export "8s_good5") (param $i i32) (result i64) 249 (i64.load8_s offset=25 align=1 (local.get $i)) ;; 122 'z' 250 ) 251 252 (func (export "16u_good1") (param $i i32) (result i64) 253 (i64.load16_u offset=0 (local.get $i)) ;; 25185 'ab' 254 ) 255 (func (export "16u_good2") (param $i i32) (result i64) 256 (i64.load16_u align=1 (local.get $i)) ;; 25185 'ab' 257 ) 258 (func (export "16u_good3") (param $i i32) (result i64) 259 (i64.load16_u offset=1 align=1 (local.get $i)) ;; 25442 'bc' 260 ) 261 (func (export "16u_good4") (param $i i32) (result i64) 262 (i64.load16_u offset=2 align=2 (local.get $i)) ;; 25699 'cd' 263 ) 264 (func (export "16u_good5") (param $i i32) (result i64) 265 (i64.load16_u offset=25 align=2 (local.get $i)) ;; 122 'z\0' 266 ) 267 268 (func (export "16s_good1") (param $i i32) (result i64) 269 (i64.load16_s offset=0 (local.get $i)) ;; 25185 'ab' 270 ) 271 (func (export "16s_good2") (param $i i32) (result i64) 272 (i64.load16_s align=1 (local.get $i)) ;; 25185 'ab' 273 ) 274 (func (export "16s_good3") (param $i i32) (result i64) 275 (i64.load16_s offset=1 align=1 (local.get $i)) ;; 25442 'bc' 276 ) 277 (func (export "16s_good4") (param $i i32) (result i64) 278 (i64.load16_s offset=2 align=2 (local.get $i)) ;; 25699 'cd' 279 ) 280 (func (export "16s_good5") (param $i i32) (result i64) 281 (i64.load16_s offset=25 align=2 (local.get $i)) ;; 122 'z\0' 282 ) 283 284 (func (export "32u_good1") (param $i i32) (result i64) 285 (i64.load32_u offset=0 (local.get $i)) ;; 1684234849 'abcd' 286 ) 287 (func (export "32u_good2") (param $i i32) (result i64) 288 (i64.load32_u align=1 (local.get $i)) ;; 1684234849 'abcd' 289 ) 290 (func (export "32u_good3") (param $i i32) (result i64) 291 (i64.load32_u offset=1 align=1 (local.get $i)) ;; 1701077858 'bcde' 292 ) 293 (func (export "32u_good4") (param $i i32) (result i64) 294 (i64.load32_u offset=2 align=2 (local.get $i)) ;; 1717920867 'cdef' 295 ) 296 (func (export "32u_good5") (param $i i32) (result i64) 297 (i64.load32_u offset=25 align=4 (local.get $i)) ;; 122 'z\0\0\0' 298 ) 299 300 (func (export "32s_good1") (param $i i32) (result i64) 301 (i64.load32_s offset=0 (local.get $i)) ;; 1684234849 'abcd' 302 ) 303 (func (export "32s_good2") (param $i i32) (result i64) 304 (i64.load32_s align=1 (local.get $i)) ;; 1684234849 'abcd' 305 ) 306 (func (export "32s_good3") (param $i i32) (result i64) 307 (i64.load32_s offset=1 align=1 (local.get $i)) ;; 1701077858 'bcde' 308 ) 309 (func (export "32s_good4") (param $i i32) (result i64) 310 (i64.load32_s offset=2 align=2 (local.get $i)) ;; 1717920867 'cdef' 311 ) 312 (func (export "32s_good5") (param $i i32) (result i64) 313 (i64.load32_s offset=25 align=4 (local.get $i)) ;; 122 'z\0\0\0' 314 ) 315 316 (func (export "64_good1") (param $i i32) (result i64) 317 (i64.load offset=0 (local.get $i)) ;; 0x6867666564636261 'abcdefgh' 318 ) 319 (func (export "64_good2") (param $i i32) (result i64) 320 (i64.load align=1 (local.get $i)) ;; 0x6867666564636261 'abcdefgh' 321 ) 322 (func (export "64_good3") (param $i i32) (result i64) 323 (i64.load offset=1 align=1 (local.get $i)) ;; 0x6968676665646362 'bcdefghi' 324 ) 325 (func (export "64_good4") (param $i i32) (result i64) 326 (i64.load offset=2 align=2 (local.get $i)) ;; 0x6a69686766656463 'cdefghij' 327 ) 328 (func (export "64_good5") (param $i i32) (result i64) 329 (i64.load offset=25 align=8 (local.get $i)) ;; 122 'z\0\0\0\0\0\0\0' 330 ) 331 332 (func (export "8u_bad") (param $i i32) 333 (drop (i64.load8_u offset=4294967295 (local.get $i))) 334 ) 335 (func (export "8s_bad") (param $i i32) 336 (drop (i64.load8_s offset=4294967295 (local.get $i))) 337 ) 338 (func (export "16u_bad") (param $i i32) 339 (drop (i64.load16_u offset=4294967295 (local.get $i))) 340 ) 341 (func (export "16s_bad") (param $i i32) 342 (drop (i64.load16_s offset=4294967295 (local.get $i))) 343 ) 344 (func (export "32u_bad") (param $i i32) 345 (drop (i64.load32_u offset=4294967295 (local.get $i))) 346 ) 347 (func (export "32s_bad") (param $i i32) 348 (drop (i64.load32_s offset=4294967295 (local.get $i))) 349 ) 350 (func (export "64_bad") (param $i i32) 351 (drop (i64.load offset=4294967295 (local.get $i))) 352 ) 353 ) 354 355 (assert_return (invoke "8u_good1" (i32.const 0)) (i64.const 97)) 356 (assert_return (invoke "8u_good2" (i32.const 0)) (i64.const 97)) 357 (assert_return (invoke "8u_good3" (i32.const 0)) (i64.const 98)) 358 (assert_return (invoke "8u_good4" (i32.const 0)) (i64.const 99)) 359 (assert_return (invoke "8u_good5" (i32.const 0)) (i64.const 122)) 360 361 (assert_return (invoke "8s_good1" (i32.const 0)) (i64.const 97)) 362 (assert_return (invoke "8s_good2" (i32.const 0)) (i64.const 97)) 363 (assert_return (invoke "8s_good3" (i32.const 0)) (i64.const 98)) 364 (assert_return (invoke "8s_good4" (i32.const 0)) (i64.const 99)) 365 (assert_return (invoke "8s_good5" (i32.const 0)) (i64.const 122)) 366 367 (assert_return (invoke "16u_good1" (i32.const 0)) (i64.const 25185)) 368 (assert_return (invoke "16u_good2" (i32.const 0)) (i64.const 25185)) 369 (assert_return (invoke "16u_good3" (i32.const 0)) (i64.const 25442)) 370 (assert_return (invoke "16u_good4" (i32.const 0)) (i64.const 25699)) 371 (assert_return (invoke "16u_good5" (i32.const 0)) (i64.const 122)) 372 373 (assert_return (invoke "16s_good1" (i32.const 0)) (i64.const 25185)) 374 (assert_return (invoke "16s_good2" (i32.const 0)) (i64.const 25185)) 375 (assert_return (invoke "16s_good3" (i32.const 0)) (i64.const 25442)) 376 (assert_return (invoke "16s_good4" (i32.const 0)) (i64.const 25699)) 377 (assert_return (invoke "16s_good5" (i32.const 0)) (i64.const 122)) 378 379 (assert_return (invoke "32u_good1" (i32.const 0)) (i64.const 1684234849)) 380 (assert_return (invoke "32u_good2" (i32.const 0)) (i64.const 1684234849)) 381 (assert_return (invoke "32u_good3" (i32.const 0)) (i64.const 1701077858)) 382 (assert_return (invoke "32u_good4" (i32.const 0)) (i64.const 1717920867)) 383 (assert_return (invoke "32u_good5" (i32.const 0)) (i64.const 122)) 384 385 (assert_return (invoke "32s_good1" (i32.const 0)) (i64.const 1684234849)) 386 (assert_return (invoke "32s_good2" (i32.const 0)) (i64.const 1684234849)) 387 (assert_return (invoke "32s_good3" (i32.const 0)) (i64.const 1701077858)) 388 (assert_return (invoke "32s_good4" (i32.const 0)) (i64.const 1717920867)) 389 (assert_return (invoke "32s_good5" (i32.const 0)) (i64.const 122)) 390 391 (assert_return (invoke "64_good1" (i32.const 0)) (i64.const 0x6867666564636261)) 392 (assert_return (invoke "64_good2" (i32.const 0)) (i64.const 0x6867666564636261)) 393 (assert_return (invoke "64_good3" (i32.const 0)) (i64.const 0x6968676665646362)) 394 (assert_return (invoke "64_good4" (i32.const 0)) (i64.const 0x6a69686766656463)) 395 (assert_return (invoke "64_good5" (i32.const 0)) (i64.const 122)) 396 397 (assert_return (invoke "8u_good1" (i32.const 65503)) (i64.const 0)) 398 (assert_return (invoke "8u_good2" (i32.const 65503)) (i64.const 0)) 399 (assert_return (invoke "8u_good3" (i32.const 65503)) (i64.const 0)) 400 (assert_return (invoke "8u_good4" (i32.const 65503)) (i64.const 0)) 401 (assert_return (invoke "8u_good5" (i32.const 65503)) (i64.const 0)) 402 403 (assert_return (invoke "8s_good1" (i32.const 65503)) (i64.const 0)) 404 (assert_return (invoke "8s_good2" (i32.const 65503)) (i64.const 0)) 405 (assert_return (invoke "8s_good3" (i32.const 65503)) (i64.const 0)) 406 (assert_return (invoke "8s_good4" (i32.const 65503)) (i64.const 0)) 407 (assert_return (invoke "8s_good5" (i32.const 65503)) (i64.const 0)) 408 409 (assert_return (invoke "16u_good1" (i32.const 65503)) (i64.const 0)) 410 (assert_return (invoke "16u_good2" (i32.const 65503)) (i64.const 0)) 411 (assert_return (invoke "16u_good3" (i32.const 65503)) (i64.const 0)) 412 (assert_return (invoke "16u_good4" (i32.const 65503)) (i64.const 0)) 413 (assert_return (invoke "16u_good5" (i32.const 65503)) (i64.const 0)) 414 415 (assert_return (invoke "16s_good1" (i32.const 65503)) (i64.const 0)) 416 (assert_return (invoke "16s_good2" (i32.const 65503)) (i64.const 0)) 417 (assert_return (invoke "16s_good3" (i32.const 65503)) (i64.const 0)) 418 (assert_return (invoke "16s_good4" (i32.const 65503)) (i64.const 0)) 419 (assert_return (invoke "16s_good5" (i32.const 65503)) (i64.const 0)) 420 421 (assert_return (invoke "32u_good1" (i32.const 65503)) (i64.const 0)) 422 (assert_return (invoke "32u_good2" (i32.const 65503)) (i64.const 0)) 423 (assert_return (invoke "32u_good3" (i32.const 65503)) (i64.const 0)) 424 (assert_return (invoke "32u_good4" (i32.const 65503)) (i64.const 0)) 425 (assert_return (invoke "32u_good5" (i32.const 65503)) (i64.const 0)) 426 427 (assert_return (invoke "32s_good1" (i32.const 65503)) (i64.const 0)) 428 (assert_return (invoke "32s_good2" (i32.const 65503)) (i64.const 0)) 429 (assert_return (invoke "32s_good3" (i32.const 65503)) (i64.const 0)) 430 (assert_return (invoke "32s_good4" (i32.const 65503)) (i64.const 0)) 431 (assert_return (invoke "32s_good5" (i32.const 65503)) (i64.const 0)) 432 433 (assert_return (invoke "64_good1" (i32.const 65503)) (i64.const 0)) 434 (assert_return (invoke "64_good2" (i32.const 65503)) (i64.const 0)) 435 (assert_return (invoke "64_good3" (i32.const 65503)) (i64.const 0)) 436 (assert_return (invoke "64_good4" (i32.const 65503)) (i64.const 0)) 437 (assert_return (invoke "64_good5" (i32.const 65503)) (i64.const 0)) 438 439 (assert_return (invoke "8u_good1" (i32.const 65504)) (i64.const 0)) 440 (assert_return (invoke "8u_good2" (i32.const 65504)) (i64.const 0)) 441 (assert_return (invoke "8u_good3" (i32.const 65504)) (i64.const 0)) 442 (assert_return (invoke "8u_good4" (i32.const 65504)) (i64.const 0)) 443 (assert_return (invoke "8u_good5" (i32.const 65504)) (i64.const 0)) 444 445 (assert_return (invoke "8s_good1" (i32.const 65504)) (i64.const 0)) 446 (assert_return (invoke "8s_good2" (i32.const 65504)) (i64.const 0)) 447 (assert_return (invoke "8s_good3" (i32.const 65504)) (i64.const 0)) 448 (assert_return (invoke "8s_good4" (i32.const 65504)) (i64.const 0)) 449 (assert_return (invoke "8s_good5" (i32.const 65504)) (i64.const 0)) 450 451 (assert_return (invoke "16u_good1" (i32.const 65504)) (i64.const 0)) 452 (assert_return (invoke "16u_good2" (i32.const 65504)) (i64.const 0)) 453 (assert_return (invoke "16u_good3" (i32.const 65504)) (i64.const 0)) 454 (assert_return (invoke "16u_good4" (i32.const 65504)) (i64.const 0)) 455 (assert_return (invoke "16u_good5" (i32.const 65504)) (i64.const 0)) 456 457 (assert_return (invoke "16s_good1" (i32.const 65504)) (i64.const 0)) 458 (assert_return (invoke "16s_good2" (i32.const 65504)) (i64.const 0)) 459 (assert_return (invoke "16s_good3" (i32.const 65504)) (i64.const 0)) 460 (assert_return (invoke "16s_good4" (i32.const 65504)) (i64.const 0)) 461 (assert_return (invoke "16s_good5" (i32.const 65504)) (i64.const 0)) 462 463 (assert_return (invoke "32u_good1" (i32.const 65504)) (i64.const 0)) 464 (assert_return (invoke "32u_good2" (i32.const 65504)) (i64.const 0)) 465 (assert_return (invoke "32u_good3" (i32.const 65504)) (i64.const 0)) 466 (assert_return (invoke "32u_good4" (i32.const 65504)) (i64.const 0)) 467 (assert_return (invoke "32u_good5" (i32.const 65504)) (i64.const 0)) 468 469 (assert_return (invoke "32s_good1" (i32.const 65504)) (i64.const 0)) 470 (assert_return (invoke "32s_good2" (i32.const 65504)) (i64.const 0)) 471 (assert_return (invoke "32s_good3" (i32.const 65504)) (i64.const 0)) 472 (assert_return (invoke "32s_good4" (i32.const 65504)) (i64.const 0)) 473 (assert_return (invoke "32s_good5" (i32.const 65504)) (i64.const 0)) 474 475 (assert_return (invoke "64_good1" (i32.const 65504)) (i64.const 0)) 476 (assert_return (invoke "64_good2" (i32.const 65504)) (i64.const 0)) 477 (assert_return (invoke "64_good3" (i32.const 65504)) (i64.const 0)) 478 (assert_return (invoke "64_good4" (i32.const 65504)) (i64.const 0)) 479 (assert_trap (invoke "64_good5" (i32.const 65504)) "out of bounds memory access") 480 481 (assert_trap (invoke "8u_bad" (i32.const 0)) "out of bounds memory access") 482 (assert_trap (invoke "8s_bad" (i32.const 0)) "out of bounds memory access") 483 (assert_trap (invoke "16u_bad" (i32.const 0)) "out of bounds memory access") 484 (assert_trap (invoke "16s_bad" (i32.const 0)) "out of bounds memory access") 485 (assert_trap (invoke "32u_bad" (i32.const 0)) "out of bounds memory access") 486 (assert_trap (invoke "32s_bad" (i32.const 0)) "out of bounds memory access") 487 (assert_trap (invoke "64_bad" (i32.const 0)) "out of bounds memory access") 488 489 (assert_trap (invoke "8u_bad" (i32.const 1)) "out of bounds memory access") 490 (assert_trap (invoke "8s_bad" (i32.const 1)) "out of bounds memory access") 491 (assert_trap (invoke "16u_bad" (i32.const 1)) "out of bounds memory access") 492 (assert_trap (invoke "16s_bad" (i32.const 1)) "out of bounds memory access") 493 (assert_trap (invoke "32u_bad" (i32.const 0)) "out of bounds memory access") 494 (assert_trap (invoke "32s_bad" (i32.const 0)) "out of bounds memory access") 495 (assert_trap (invoke "64_bad" (i32.const 1)) "out of bounds memory access") 496 497 ;; Load f32 data with different offset/align arguments 498 499 (module 500 (memory 1) 501 (data (i32.const 0) "\00\00\00\00\00\00\a0\7f\01\00\d0\7f") 502 503 (func (export "32_good1") (param $i i32) (result f32) 504 (f32.load offset=0 (local.get $i)) ;; 0.0 '\00\00\00\00' 505 ) 506 (func (export "32_good2") (param $i i32) (result f32) 507 (f32.load align=1 (local.get $i)) ;; 0.0 '\00\00\00\00' 508 ) 509 (func (export "32_good3") (param $i i32) (result f32) 510 (f32.load offset=1 align=1 (local.get $i)) ;; 0.0 '\00\00\00\00' 511 ) 512 (func (export "32_good4") (param $i i32) (result f32) 513 (f32.load offset=2 align=2 (local.get $i)) ;; 0.0 '\00\00\00\00' 514 ) 515 (func (export "32_good5") (param $i i32) (result f32) 516 (f32.load offset=8 align=4 (local.get $i)) ;; nan:0x500001 '\01\00\d0\7f' 517 ) 518 (func (export "32_bad") (param $i i32) 519 (drop (f32.load offset=4294967295 (local.get $i))) 520 ) 521 ) 522 523 (assert_return (invoke "32_good1" (i32.const 0)) (f32.const 0.0)) 524 (assert_return (invoke "32_good2" (i32.const 0)) (f32.const 0.0)) 525 (assert_return (invoke "32_good3" (i32.const 0)) (f32.const 0.0)) 526 (assert_return (invoke "32_good4" (i32.const 0)) (f32.const 0.0)) 527 (assert_return (invoke "32_good5" (i32.const 0)) (f32.const nan:0x500001)) 528 529 (assert_return (invoke "32_good1" (i32.const 65524)) (f32.const 0.0)) 530 (assert_return (invoke "32_good2" (i32.const 65524)) (f32.const 0.0)) 531 (assert_return (invoke "32_good3" (i32.const 65524)) (f32.const 0.0)) 532 (assert_return (invoke "32_good4" (i32.const 65524)) (f32.const 0.0)) 533 (assert_return (invoke "32_good5" (i32.const 65524)) (f32.const 0.0)) 534 535 (assert_return (invoke "32_good1" (i32.const 65525)) (f32.const 0.0)) 536 (assert_return (invoke "32_good2" (i32.const 65525)) (f32.const 0.0)) 537 (assert_return (invoke "32_good3" (i32.const 65525)) (f32.const 0.0)) 538 (assert_return (invoke "32_good4" (i32.const 65525)) (f32.const 0.0)) 539 (assert_trap (invoke "32_good5" (i32.const 65525)) "out of bounds memory access") 540 541 (assert_trap (invoke "32_bad" (i32.const 0)) "out of bounds memory access") 542 (assert_trap (invoke "32_bad" (i32.const 1)) "out of bounds memory access") 543 544 ;; Load f64 data with different offset/align arguments 545 546 (module 547 (memory 1) 548 (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") 549 550 (func (export "64_good1") (param $i i32) (result f64) 551 (f64.load offset=0 (local.get $i)) ;; 0.0 '\00\00\00\00\00\00\00\00' 552 ) 553 (func (export "64_good2") (param $i i32) (result f64) 554 (f64.load align=1 (local.get $i)) ;; 0.0 '\00\00\00\00\00\00\00\00' 555 ) 556 (func (export "64_good3") (param $i i32) (result f64) 557 (f64.load offset=1 align=1 (local.get $i)) ;; 0.0 '\00\00\00\00\00\00\00\00' 558 ) 559 (func (export "64_good4") (param $i i32) (result f64) 560 (f64.load offset=2 align=2 (local.get $i)) ;; 0.0 '\00\00\00\00\00\00\00\00' 561 ) 562 (func (export "64_good5") (param $i i32) (result f64) 563 (f64.load offset=18 align=8 (local.get $i)) ;; nan:0xc000000000001 '\01\00\00\00\00\00\fc\7f' 564 ) 565 (func (export "64_bad") (param $i i32) 566 (drop (f64.load offset=4294967295 (local.get $i))) 567 ) 568 ) 569 570 (assert_return (invoke "64_good1" (i32.const 0)) (f64.const 0.0)) 571 (assert_return (invoke "64_good2" (i32.const 0)) (f64.const 0.0)) 572 (assert_return (invoke "64_good3" (i32.const 0)) (f64.const 0.0)) 573 (assert_return (invoke "64_good4" (i32.const 0)) (f64.const 0.0)) 574 (assert_return (invoke "64_good5" (i32.const 0)) (f64.const nan:0xc000000000001)) 575 576 (assert_return (invoke "64_good1" (i32.const 65510)) (f64.const 0.0)) 577 (assert_return (invoke "64_good2" (i32.const 65510)) (f64.const 0.0)) 578 (assert_return (invoke "64_good3" (i32.const 65510)) (f64.const 0.0)) 579 (assert_return (invoke "64_good4" (i32.const 65510)) (f64.const 0.0)) 580 (assert_return (invoke "64_good5" (i32.const 65510)) (f64.const 0.0)) 581 582 (assert_return (invoke "64_good1" (i32.const 65511)) (f64.const 0.0)) 583 (assert_return (invoke "64_good2" (i32.const 65511)) (f64.const 0.0)) 584 (assert_return (invoke "64_good3" (i32.const 65511)) (f64.const 0.0)) 585 (assert_return (invoke "64_good4" (i32.const 65511)) (f64.const 0.0)) 586 (assert_trap (invoke "64_good5" (i32.const 65511)) "out of bounds memory access") 587 588 (assert_trap (invoke "64_bad" (i32.const 0)) "out of bounds memory access") 589 (assert_trap (invoke "64_bad" (i32.const 1)) "out of bounds memory access")