rust-lang / rust-lang/rustc_codegen_gcc

Possible ARM bug

Open
#701 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

arm bug
Dominant language
Rust
Stars
1.2k
Forks
105
Avg merge
8h 20m
Merged PRs (30d)
14

Description

This program behaves differently with optimizations enabled on ARM:

use core::ffi::*;
extern "C" {
    pub fn printf(format: *const c_char, ...) -> c_int;
}
fn dump_var(val3: f32) {
    if val3 != 1902660900.0 {
        unsafe { printf(b"wrong\n\0".as_ptr() as *const _) };
    }
}
fn main() {
    let mut _9 = 43619u128;
    let _64 = &mut _9;
    let _27 = _9 as f32;
    let _29 = 43619.0 * _27;
    dump_var(_29 + 43619.0)
}
Unoptimized: 

Optimized:
wrong

(I am using printf here to make porting the code to C easier)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Run the supplied Rust reproducer on ARM with and without optimizations, compare the output, and inspect the optimized codegen path for the differing floating-point result. Done means identifying whether the optimized result is incorrect and documenting or testing the failure in the appropriate codegen area.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.