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.0
and exits - "works fine": loop produces 100 values
Some comments for the code:
- "bad" case formats
f32
to human readable string - "good" case formats
u32
to hexadecimal number to_bits
convertsf32
tou32
as is at bits representationPrintf
is 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