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
{{ message }}
Repository navigation
wasm32-unknown-unknown produces "index out of bounds" when not optimized #46367
With the current nightly builds (1.24.0-nightly (73bca2b 2017-11-28)), some (I assume most) programs are unrunnable on wasm32-unknown-unknown (tested in Firefox 56.0) unless compiled with optimization flags. The condition appears somewhere between where the start function and main is called in this example, but I've also tested overriding the start function to a no-op, and then the most simple functions (just returning an integer) worked, but anything that called another function didn't.
Steps to reproduce:
#[no_mangle]pubextern"C"fnpub_function(x:i32) -> i32{2* x }pubfnmain(){}
as demo.rs; compile with rustc +nightly --target wasm32-unknown-unknown -O demo.rs and serve together with this index.html:
… and the console will print 84. Leave out the -O, and instead, the console will give RuntimeError: index out of bounds, with a stack trace 7 deep into the start function at a i32.store offset=4 instruction.
Not sure if this is minimal enough to be helpful, but we're hitting this error when calling futures::sync::mpsc::unbounded. Here is a gist in case it's at all useful.
Activity
alexcrichton commentedon Nov 29, 2017
Looks like this is a bug in LLVM -- if LLVM asserts are enabled I get:
and that was even with LLVM 5! We'll want to eventually report this upstream when we can get a reduced test case.
jakerr commentedon Nov 30, 2017
Here's a reproduction: https://github.com/jakerr/wasm-bug-repro
nathansobo commentedon Jan 22, 2018
Not sure if this is minimal enough to be helpful, but we're hitting this error when calling
futures::sync::mpsc::unbounded. Here is a gist in case it's at all useful.alexcrichton commentedon Mar 6, 2018
Confirmed to be fixed with #48125!