-
Notifications
You must be signed in to change notification settings - Fork 223
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
Serial writes aren't working on rustc 1.82.0-nightly (8e86c9567 2024-08-01)
#571
Comments
By comparing a diff of the generated assembly, you can see the difference. - cpi r25, 0
- breq .LBB1_1
+ cpi r25, 1
+ brne .LBB1_1 The prior rust version (commit Odds are, I've very much misinterpreted that, however. So, in place of the fact I have no clue what I'm doing, I'm going to call the one person who I believe can help. @Patryk27. This seems like a you kind of thing, if you don't mind. |
Thanks for pinging, I'll take a look later! |
Alright, so that comparison is actually correct - it's like This codegen difference stems from some changes within rustc / llvm optimizations, because it used to generate: %_9.not = icmp eq i8 %1, 0
br i1 %_9.not, label %bb11, label %bb10 ... but since 2024-08-01 it generates this instead: %_9 = trunc nuw i8 %1 to i1
br i1 %_9, label %bb10, label %bb11 I think both snippets are correct and what caught my attention were the jumps - all |
Status: I've confirmed it's a regression with LLVM (building newest rustc locally with LLVM 18 yields a correct binary), will try to |
Alright, it looks like the breaking commit was llvm/llvm-project@6859685 (or, more precisely, llvm/llvm-project@84428da, because the former has a small compilation issue fixed by this commit). Now, onto discovering why an unrelated change broke AVR 🔍 |
Got a lead, the difference between both versions boils down to this check: This function returns |
Status: patch is ready (llvm/llvm-project#102936), waiting for review. |
Unrelated to the fix. I'm working on a project that's encountering this bug. How do I rebuild using the old version of |
in your project you can define a rust-toolchain.toml file like its done here. Instead of using "nightly" you can specify a nightly version with a date of that nightly version. |
@Tellurian-Ul, navigate to your project root folder and run the command below: rustup override set nightly-2024-07-25 |
Status: fix got merged into |
Alright, fixed in the newest toolchain 🙂 |
After updating the rustc compiler to
rustc 1.82.0-nightly (8e86c9567 2024-08-01)
fromrustc 1.82.0-nightly (c1a6199e9 2024-07-24)
, serial writes don't work properly any more.Here is the minimal reproducible example for the Arduino Mega 2560:
The console prints out
Serial initialised!
with a new line at the back as expected onrustc 1.82.0-nightly (c1a6199e9 2024-07-24)
, but only printsS
onrustc 1.82.0-nightly (8e86c9567 2024-08-01)
. Nothing is printed to the console if other things are being initialised before the serial handler, such as a timer or a stepper motor driver.I believe this should also be reproducible on the Arduino Uno as well.
The text was updated successfully, but these errors were encountered: