wabt icon indicating copy to clipboard operation
wabt copied to clipboard

wasm-decompile decompile error

Open spencerwuwu opened this issue 5 months ago • 2 comments

Hi wabt team,

Recently I have been testing the decompile tool chain of WebAssembly. This is conducted by comparing the results of a C program:

  • compile into WASM, decompile with wasm-decompile, rewrite syntax and re-compile into native binary.
  • directly compile into native binary.

A few execution discrepancies are discovered during this process. One is as the displayed code snipped. It seems like the recovered data flow is incorrect. image image

May I ask if this is an implementation error, or am I missing anything here?

Attaching the files related to this report. 198.zip

  • 198.c: A C program generated with csmith. The goal is to compare the final hash value after executing func_1.
  • 198 is the compiled WASM
  • 198_wasm-decompile.c: Decompiled result by wasm-decompile.
  • 198_new.c: Extract the decompiled func_1 in 198_wasm-decompile.c and fix the syntax to make it re-compilable

Thank you

spencerwuwu avatar Sep 26 '24 21:09 spencerwuwu