-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong code generated for Android ARM with optimisations #22776
Comments
Not reproducible.
|
I tried the latest nightly on a different host OS, unfortunately still reproducible:
|
Just another update: Reproduced with Rust Beta2 and a newer version of byteorder (which accidentally but thankfully reintroduced the issue but is now patched again, so there is a recent commit that compiles with the latest rustc). Specifically:
|
I think the problem here is (the old) I'm closing since I don't think this is a bug in Rust, and thanks to @romanb for diagnosing and even fixing the problem in |
There appears to be a case that looks like optimisations resulting in bad code to be generated for Android ARM. This issue demonstrates the problem in the context where I ran into it, using the byteorder library.
Test environment
arm-linux-androideabi
target.Steps to reproduce
Clone byteorder. Checkout commit
d9259c15a4b18de37d765aebbe5034f282772b84
.Create main.rs:
Build
Run on emulator
Output
Expected:
Actual (sample):
Workarounds
There seem to be two ways to work around the problem:
Apply the following patch to
byteorder
Turn off optimizations (
opt-level
).Further Details
The following is the output for the relevant functions (
write_u16
,write_u32
andwrite_u64
) of compilingbyteorder
using--emit=llvm-ir
with and without the above patch.Without the patch: https://gist.github.com/romanb/2ff2ebb474c87103e631
With the patch: https://gist.github.com/romanb/d419ba4882d9c489c494
The text was updated successfully, but these errors were encountered: