You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wasm-bindgen build command succeeds, but the generated binary crashes with RuntimeError: memory access out of bounds. main.rs is generated by the https://github.com/AU-COBRA/coq-rust-extraction plugin, it could be a bug there as well. I suspect it's in wasm-bindgen, because the setup works with a standard rust setup.
cargo run in the attached project works, it prints the expected result Some(O(PhantomData<&()>)).
(The source program takes an arithmetic expression representing the sum of 1 to n, compiles it to a toy stack-machine
and executes it, then subtracts n*(n+1)/2 from the result, so the expected value is 0.)
In the attached project, the main file is exactly the same as in the working one above,
except for the lines at the bottom related to wasm-bindgen.
wasm-pack build --target nodejs
in pkg/sm_gauss_nat.js: replace write_string with console.log and add wasm.main() at the bottom
then run with nodejs: node --stack-size=1000000 sm_gauss_nat.js
Fails with the following error
Error
wolfgang@laptop:~/sm_gauss_nat-extracted/pkg$ node --stack-size=1000000 sm_gauss_nat.js
wasm://wasm/0005b416:1
RuntimeError: memory access out of bounds
at wasm://wasm/0005b416:wasm-function[22]:0x3b74
at wasm://wasm/0005b416:wasm-function[22]:0x3b3d
at wasm://wasm/0005b416:wasm-function[22]:0x3b5f
at wasm://wasm/0005b416:wasm-function[22]:0x3b3d
at wasm://wasm/0005b416:wasm-function[22]:0x3b5f
at wasm://wasm/0005b416:wasm-function[22]:0x3b3d
at wasm://wasm/0005b416:wasm-function[22]:0x3b5f
at wasm://wasm/0005b416:wasm-function[22]:0x3b3d
at wasm://wasm/0005b416:wasm-function[22]:0x3b5f
at wasm://wasm/0005b416:wasm-function[22]:0x3b3d
Node.js v20.11.1
Possibly relevant
The main.rs is generated by a compiler, and the setup with the wasm-bindgen macros works as expected on a few other programs. We have some other Wasm binaries here, which one can run with included Node.js based run script,
I can provide more source code for the working examples in case it helps.
Thanks!
The text was updated successfully, but these errors were encountered:
Description
The
wasm-bindgen
build command succeeds, but the generated binary crashes withRuntimeError: memory access out of bounds
.main.rs
is generated by the https://github.com/AU-COBRA/coq-rust-extraction plugin, it could be a bug there as well. I suspect it's inwasm-bindgen
, because the setup works with a standard rust setup.Working setup without
wasm-bindgen
sm_gauss_nat-working.zip
cargo run
in the attached project works, it prints the expected resultSome(O(PhantomData<&()>))
.(The source program takes an arithmetic expression representing the sum of 1 to n, compiles it to a toy stack-machine
and executes it, then subtracts
n*(n+1)/2
from the result, so the expected value is 0.)Steps to Reproduce
sm_gauss_nat-crashing.zip
In the attached project, the main file is exactly the same as in the working one above,
except for the lines at the bottom related to
wasm-bindgen
.wasm-pack build --target nodejs
pkg/sm_gauss_nat.js
: replacewrite_string
withconsole.log
and addwasm.main()
at the bottomnode --stack-size=1000000 sm_gauss_nat.js
Error
Possibly relevant
The
main.rs
is generated by a compiler, and the setup with thewasm-bindgen
macros works as expected on a few other programs. We have some other Wasm binaries here, which one can run with includedNode.js
based run script,I can provide more source code for the working examples in case it helps.
Thanks!
The text was updated successfully, but these errors were encountered: