File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 240
240
" (import \"\" \"\" (memory $foo 1))"
241
241
" (import \"\" \"\" (memory $foo 1))" )
242
242
" duplicate memory" )
243
+
244
+ ;; Test that exporting random globals does not change a memory's semantics.
245
+
246
+ (module
247
+ (memory (export " memory" ) 1 1 )
248
+
249
+ ;; These should not change the behavior of memory accesses.
250
+ (global (export " __data_end" ) i32 (i32.const 10000 ))
251
+ (global (export " __stack_top" ) i32 (i32.const 10000 ))
252
+ (global (export " __heap_base" ) i32 (i32.const 10000 ))
253
+
254
+ (func (export " load" ) (param i32 ) (result i32 )
255
+ (i32.load8_u (local.get 0 ))
256
+ )
257
+ )
258
+
259
+ ;; None of these memory accesses should trap.
260
+ (assert_return (invoke " load" (i32.const 0 )) (i32.const 0 ))
261
+ (assert_return (invoke " load" (i32.const 10000 )) (i32.const 0 ))
262
+ (assert_return (invoke " load" (i32.const 20000 )) (i32.const 0 ))
263
+ (assert_return (invoke " load" (i32.const 30000 )) (i32.const 0 ))
264
+ (assert_return (invoke " load" (i32.const 40000 )) (i32.const 0 ))
265
+ (assert_return (invoke " load" (i32.const 50000 )) (i32.const 0 ))
266
+ (assert_return (invoke " load" (i32.const 60000 )) (i32.const 0 ))
267
+ (assert_return (invoke " load" (i32.const 65535 )) (i32.const 0 ))
You can’t perform that action at this time.
0 commit comments