bulk_data_drop.wat (500B)
1 (module 2 (memory 1) 3 (data $seg "\2a\00\00\00") 4 (func (export "test_main") (result i32) 5 ;; First init succeeds: copies the 4 bytes to offset 64. 6 i32.const 64 7 i32.const 0 8 i32.const 4 9 memory.init $seg 10 ;; Drop the segment; subsequent memory.init $seg of nonzero length traps. 11 data.drop $seg 12 ;; Second init with len=0 must succeed (dropped segment, but len 0 is ok). 13 i32.const 0 14 i32.const 0 15 i32.const 0 16 memory.init $seg 17 i32.const 64 18 i32.load))