binaryen
binaryen copied to clipboard
Wrong code with spill-pointers
Hi,
wasm-opt
seems to produce wrong code for the following program with --spill-pointers
pass.
$ emcc -W small.c -o small.js; node small.js
5
$ wasm-opt small.wasm --spill-pointers -o small.wasm; node small.js
0
$ cat small.c
#include "stdio.h"
int a = 5;
int main() { printf("%d\n", a); }
Version:
$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.30 (cfe2bdfe2692457cb5f5770672f6e5ccb3ffc2f2)
clang version 16.0.0 (https://github.com/llvm/llvm-project 800f0f1546b2352ba42a4777149afb13cb874fcd)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/emsdk/upstream/bin
$ wasm-opt --version
wasm-opt version 111 (version_111-98-ga803a0830)
OS: Ubuntu 22.04
https://github.com/WebAssembly/binaryen/pull/6294 might fix this
I noticed that the issue has already been resolved by the PR. Thank you for addressing it!