-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
[AVR] result of i32 as f32
is incorrect
#77131
Comments
Off-topic but this is caused by rust-lang/compiler-builtins#347 ... |
I believe I've hit this issue too in TinyGo, if I remember correctly one of these patches would fix it: |
Currently the original code with
... but changing the impl<const S: usize> ufmt::uDisplay for Buffer<S> {
fn fmt<W: ufmt::uWrite + ?Sized>(
&self,
f: &mut ufmt::Formatter<'_, W>,
) -> Result<(), W::Error> {
for ch in self.0.iter() {
f.write_char(*ch as char);
}
Ok(())
}
} ... seems to render a correct code, one that yields the expected results:
(requires https://reviews.llvm.org/D114611 + #82242 (comment)) |
As I understand it, this issue is resolved and adding simulation testing for functional correctness (as opposed to merely building correctly) for a tier 3 target may constitute a significant policy change, so I am closing this. |
I tried this code: https://github.com/jsen-/rust-i32-as-f32-issue-repro
I expected to see this happen:
Every
i32
value converted tof32
should have equal decimal part and zeros-only after decimal point.Instead, this happened:
full output
Meta
rustc --version --verbose
:tested on
arduino nano
Note: I updated compiler-builtins to
0.1.36
, because without this commit I was getting undefined symbols__ashlsi3
and__lshrsi3
Note2:: Debug builds don't link due to missing references
core::panicking::panic::hc30e67a739c4d8d1
, but that's a separate issue. Release builds fine.The text was updated successfully, but these errors were encountered: