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
When building machine code for a wasm function which calls a host function and passes in a pointer to a 'static string, the offset to the string data is passed through incorrectly (0 is passed).
The pointer argument received by the host function banana should be an offset to the first byte of UTF-8 encoding of the string "bananapeach" within the memory.
The behaviour should be consistent between backends.
Actual behavior
Test when run with the singlepass backend passes through an offset 0 (even though the wasm code itself has a proper offset encoded within it!)
nagisa
changed the title
Pointers to static variables are sometimes passed incorrectly with the singlepass compiler
Pointers to static data are sometimes passed incorrectly with the singlepass compiler
Dec 13, 2021
The wasm snippet in the test corresponds to roughly:
```rust
let name = "bananapeach";
banana(a, b, c, name.len() as _, name.as_ptr() as _, f, g, h);
```
however sometime between 2.0 and 2.1 the name pointer is no longer being
passed through as an argument. Instead a 0 gets passed in.
To make things weirder, if `name.as_ptr()` is passed through multiple
times, the second time the pointer will get passed correctly.
2723: fix#2721, also adding the test in the regression test suite r=ptitSeb a=ptitSeb
# Description
Fix for #2721, regression introduce with Windows backend for Singlepass.
Co-authored-by: ptitSeb <[email protected]>
2725: Regression test for #2721 r=syrusakbary a=nagisa
The wasm snippet in the test corresponds to roughly:
```rust
let name = "bananapeach";
banana(a, b, c, name.len() as _, name.as_ptr() as _, f, g, h);
```
however sometime between 2.0 and 2.1 the name pointer is no longer being
passed through as an argument. Instead a 0 gets passed in.
To make things weirder, if `name.as_ptr()` is passed through multiple
times, the second time the pointer will get passed correctly.
The fix for this issue is in #2723.
Co-authored-by: Simonas Kazlauskas <[email protected]>
Co-authored-by: Syrus Akbary <[email protected]>
Describe the bug
When building machine code for a wasm function which calls a host function and passes in a pointer to a
'static
string, the offset to the string data is passed through incorrectly (0
is passed).Steps to reproduce
make test-compilers
at master...nagisa:test-for-argpassingExpected behavior
The pointer argument received by the host function
banana
should be an offset to the first byte of UTF-8 encoding of the string"bananapeach"
within the memory.The behaviour should be consistent between backends.
Actual behavior
Test when run with the
singlepass
backend passes through an offset 0 (even though the wasm code itself has a proper offset encoded within it!)Additional information
This is a regression introduced by 8f855cf.
The text was updated successfully, but these errors were encountered: