Skip to content

exscape/float-bug-testcase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

avr-rust / LLVM float bug

Update: I found the source of this bug. LLVM believes the float comparison (generated due to AVR not having floating point hardware) returns a 32-bit value, while it is actually only 8 bits.
Implementing AVRTargetLowering::getCmpLibcallReturnType() to return MVT::i8 solves this issue.

    let num = 22.625f32;
    if num < 0.0 {
        // This code executes!
    }
    if 22.625f32 < 0.0 {
        // This code does *not* run, due to optimization.
    }

I compile this repo with:
xargo build --target avr-atmega328p

Everything else in included in this repo.

Tested with avr-rust/rust 6092c82d02b2498b413cbdee5b8617186b70425d

About

Test case for a suspected bug in avr-rust/LLVM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages