Skip to content
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

saturating-float-casts test from rustc test suite is panicking #737

Closed
bjorn3 opened this issue Oct 1, 2019 · 5 comments
Closed

saturating-float-casts test from rustc test suite is panicking #737

bjorn3 opened this issue Oct 1, 2019 · 5 comments
Labels
C-bug Category: This is a bug.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Oct 1, 2019

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `170141183460469231731687303715884105727`,
 right: `0`: run-time f32 -> i128', example/saturating-float-casts.rs:95:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.38/src/backtrace/libunwind.rs:88
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
./test.sh: regel 59: 17537 Afgebroken              ./target/out/saturating_float_casts

cc #381

@bjorn3 bjorn3 added the C-bug Category: This is a bug. label Oct 1, 2019
@bjorn3 bjorn3 added this to the MVP milestone Oct 1, 2019
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 1, 2019

170141183460469231731687303715884105727 == 0x7fffffffffffffffffffffffffffffff

@bjorn3 bjorn3 changed the title saturating-float-casts test from rustc test suite panicking saturating-float-casts test from rustc test suite is panicking Oct 2, 2019
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 2, 2019

Reduced to:

// cranelift doesn't inline
fn black_box<T>(a: T) -> T {
    a
}

pub fn main() {
    assert_eq!(black_box(std::f32::NAN) as i128, 0);
}

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 9, 2019

Opened rust-lang/rust#65245

@bjorn3 bjorn3 removed this from the MVP milestone Jan 22, 2020
@bjorn3
Copy link
Member Author

bjorn3 commented Jan 22, 2020

Removed from MVP milestone as this is just an edge case.

@bjorn3 bjorn3 closed this as completed in f3d97cc Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

1 participant