forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Description
Hi,
I have encountered into the regression in the current xtensa_release_9.0.1 branch.
Previously I used GCC based branch and it works fine.
Worth noting that I also changed the Rust version, so it may be related.
To reproduce the issue I have prepared minimal version of Rust code:
#[no_mangle]
#[inline(never)]
fn test_float_cmp() {
let mut f: f32 = 10.0;
let mut p = Printf {};
while f > 0.0 {
// works fine
// let _ = writeln!(p, "{:04x}", f.to_bits());
// works bad
let _ = writeln!(p, "{}", f);
f -= 0.1;
}
}- "works bad": loop produces only one value
10.0and exits - "works fine": loop produces 100 values
Some comments for the code:
- "bad" case formats
f32to human readable string - "good" case formats
u32to hexadecimal number to_bitsconvertsf32tou32as is at bits representationPrintfis thin wrapper around regular C's `printf:
struct Printf;
impl Write for Printf {
fn write_str(&mut self, s: &str) -> Result {
for c in s.as_bytes() {
unsafe { printf("%c\0".as_ptr() as *const _, *c as i32) }
}
Ok(())
}
}I've attached archive with: Rust source code demo, disassembled code for "good" and "bad" cases, final binary and LLVM bitcode files:
P.S. Actually I use https://github.com/mabezdev/llvm-project fork, but now it contains only one commit ahead of this branch.
Metadata
Metadata
Assignees
Labels
No labels