WebAssembly / binaryen

Optimizer and compiler/toolchain library for WebAssembly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentation fault although no optimization is done

wackazong opened this issue · comments

I have a wasm file which causes a segementation fault in wasm-opt, even if not using any optimization. What can I do to resolve this?

writeInt8: 0 (at 9855286)
writeInt8: 3 (at 9855287)
writeInt8: 0 (at 9855288)
writeInt8: 0 (at 9855289)
writeInt8: 0 (at 9855290)
writeInt8: 0 (at 9855291)
writeInt8: 0 (at 9855292)
writeInt8: 0 (at 9855293)
writeInt8: 0 (at 9855294)
writeInt8: 0 (at 9855295)
writeInt8: 0 (at 9855296)
writeInt8: 0 (at 9855297)
writeInt8: 0 (at 9855298)
writeInt8: 0 (at 9855299)
writeInt8: 0 (at 9855300)
writeInt8: 0 (at 9855301)
writeInt8: 0 (at 9855302)
writeInt8: 0 (at 9855303)
writeInt8: 0 (at 9855304)
writeInt8: 0 (at 9855305)
writeInt8: 0 (at 9855306)
writeInt8: 0 (at 9855307)
writeInt8: 0 (at 9855308)
writeInt8: 0 (at 9855309)
writeInt8: 0 (at 9855310)
writeInt8: 2 (at 9855311)
writeInt8: 0 (at 9855312)
writeInt8: 0 (at 9855313)
writeInt8: 0 (at 9855314)
writeAtU32LEB: 8373064 (at 1482246)
[1]    48856 segmentation fault  wasm-opt App_bg.wasm -o test.wasm --debug

Are you able to share the wasm file so we can investigate and fix the bug?

Also, wasm-gc gives me this error:

thread 'main' panicked at /.../wasm-gc-0.1.6/src/main.rs:45:36:
failed to parse wasm module: Error(UnknownOpcode(195))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    49797 abort      wasm-gc app.wasm

Stack trace shows it crashes in DWARF support code. Our DWARF support is not very robust, and not the focus of current work. To work around this issue, pass --strip-dwarf (which will remove it before writing).