-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Miscompilation in unoptimized builds on aarch64 with 1.57.0 #92786
Comments
Was able to also test Rust 1.53 & 1.55, both perform as expected and show i: 0 |
@jfro Are the numbers printed the same every time or do they vary? |
Consistently |
Thanks. The reason I was asking is that, if you're reading invalid memory, the result is usually random. Since this result is consistent, something else is probably going on. |
For the sake of convenience, could you please provide the |
here you go: |
It might be a coincidence but, |
Edit: It's caused by |
When I use the llc from the rustup toolchain, I see LLVM going wild with
Note that Weirdly I don't see this when using the llc from my local rust build :/ |
For this example, the llc distributed by rustup produces (with
While my own build produces:
|
Looks like it works if LLVM is compiled with assertions and breaks when compiled without assertions :( |
@nikic Are you saying that you can reproduce two different results using the same IR? I was seeing the issue with This is the line of IR that is causing the issues. It is only present with
Additionally, it's only a problem if I assign
|
This llvm bug seems like it may be relevant. Switching to |
Bisect shows this is fixed by llvm/llvm-project@67bf3ac on main. Edit: It looks that shortly after that llvm/llvm-project@04fb9b7 landed and the change was reverted again. |
@nikic The revert comment suggests that it should be fixed by this commit. Are you able to confirm? |
I've filed llvm/llvm-project#53162 to check whether we can still get this in 13.0.1, though probably not. In that case I'll cherry-pick into our fork. |
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-critical |
Update LLVM submodule Update LLVM to fix rust-lang#92786.
Minimized from a program @jfro was trying to debug.
I tried this code:
I expected to see this happen:
Instead, this happened:
Meta
I see this on aarch64 and not on x86_64. I don't have access to any other architectures. Output is as expected with
--release
. I can also observe this bug on the previous stable (1.56.1), current beta (1.58.0-beta.3) and current nightly (89b9f7b 2022-01-10).rustc --version --verbose
:The text was updated successfully, but these errors were encountered: