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
extern{fnlog_i32(val:i32);}#[no_mangle]pubfnrun(){let s = "Tre".as_bytes();let len = s.len();unsafe{log_i32(len asi32);}}
This should yield 3. It however gives 0 when compiling with the following command: rustc +nightly -C opt-level=0 --target wasm32-unknown-unknown --crate-type=cdylib src/main.rs
Any opt-level above 0 is fine though. (eg rustc +nightly -C opt-level=1 --target wasm32-unknown-unknown --crate-type=cdylib src/main.rs)
The fat pointer of s contains the correct length in memory, just the len method returns the wrong value.
I only have access to the mangled opt-level=0 WAT so I cannot investigate what WASM or LLVM-IR is doing there.
The text was updated successfully, but these errors were encountered:
This should yield
3
. It however gives0
when compiling with the following command:rustc +nightly -C opt-level=0 --target wasm32-unknown-unknown --crate-type=cdylib src/main.rs
Any
opt-level
above 0 is fine though. (egrustc +nightly -C opt-level=1 --target wasm32-unknown-unknown --crate-type=cdylib src/main.rs
)The fat pointer of
s
contains the correct length in memory, just thelen
method returns the wrong value.I only have access to the mangled
opt-level=0
WAT so I cannot investigate what WASM or LLVM-IR is doing there.The text was updated successfully, but these errors were encountered: