diff --git a/libm/src/math/ceil.rs b/libm/src/math/ceil.rs index c8fb17e7d..fe321337e 100644 --- a/libm/src/math/ceil.rs +++ b/libm/src/math/ceil.rs @@ -62,6 +62,11 @@ mod tests { (-1.0, -1.0, Status::OK), (<$f>::INFINITY, <$f>::INFINITY, Status::OK), (<$f>::NEG_INFINITY, <$f>::NEG_INFINITY, Status::OK), + (<$f>::NAN, <$f>::NAN, Status::OK), + (<$f>::NEG_NAN, <$f>::NEG_NAN, Status::OK), + // FIXME(snan): these should technically quiet the sNaN and return INVALID. + (<$f>::SNAN, <$f>::SNAN, Status::OK), + (<$f>::NEG_SNAN, <$f>::NEG_SNAN, Status::OK), // with rounding (0.1, 1.0, Status::INEXACT), (-0.1, -0.0, Status::INEXACT), diff --git a/libm/src/math/floor.rs b/libm/src/math/floor.rs index 2b1e31c05..68018cbf8 100644 --- a/libm/src/math/floor.rs +++ b/libm/src/math/floor.rs @@ -62,6 +62,11 @@ mod tests { (-1.0, -1.0, Status::OK), (<$f>::INFINITY, <$f>::INFINITY, Status::OK), (<$f>::NEG_INFINITY, <$f>::NEG_INFINITY, Status::OK), + (<$f>::NAN, <$f>::NAN, Status::OK), + (<$f>::NEG_NAN, <$f>::NEG_NAN, Status::OK), + // FIXME(snan): these should technically quiet the sNaN and return INVALID. + (<$f>::SNAN, <$f>::SNAN, Status::OK), + (<$f>::NEG_SNAN, <$f>::NEG_SNAN, Status::OK), // with rounding (0.1, 0.0, Status::INEXACT), (-0.1, -1.0, Status::INEXACT), diff --git a/libm/src/math/rint.rs b/libm/src/math/rint.rs index 75c46acc0..5a6024433 100644 --- a/libm/src/math/rint.rs +++ b/libm/src/math/rint.rs @@ -66,6 +66,12 @@ mod tests { (-1.0, -1.0, Status::OK), (<$f>::INFINITY, <$f>::INFINITY, Status::OK), (<$f>::NEG_INFINITY, <$f>::NEG_INFINITY, Status::OK), + // FIXME: these should return OK status + (<$f>::NAN, <$f>::NAN, Status::INEXACT), + (<$f>::NEG_NAN, <$f>::NEG_NAN, Status::INEXACT), + // FIXME(snan): these should technically quiet the sNaN and return INVALID. + (<$f>::SNAN, <$f>::SNAN, Status::INEXACT), + (<$f>::NEG_SNAN, <$f>::NEG_SNAN, Status::INEXACT), // with rounding (0.1, 0.0, Status::INEXACT), (-0.1, -0.0, Status::INEXACT), diff --git a/libm/src/math/round.rs b/libm/src/math/round.rs index 091cd801a..8ed537f76 100644 --- a/libm/src/math/round.rs +++ b/libm/src/math/round.rs @@ -66,6 +66,11 @@ mod tests { let val = f(x); assert_biteq!(val, exp_res, "round({x:?}) {}", Hex(x)); } + + assert!(f(F::NAN).is_qnan()); + assert!(f(F::NEG_NAN).is_qnan()); + assert!(f(F::SNAN).is_qnan()); + assert!(f(F::NEG_SNAN).is_qnan()); } #[test] diff --git a/libm/src/math/trunc.rs b/libm/src/math/trunc.rs index 9eb902ea5..cd6ed6393 100644 --- a/libm/src/math/trunc.rs +++ b/libm/src/math/trunc.rs @@ -61,6 +61,11 @@ mod tests { (-1.0, -1.0, Status::OK), (<$f>::INFINITY, <$f>::INFINITY, Status::OK), (<$f>::NEG_INFINITY, <$f>::NEG_INFINITY, Status::OK), + (<$f>::NAN, <$f>::NAN, Status::OK), + (<$f>::NEG_NAN, <$f>::NEG_NAN, Status::OK), + // FIXME(snan): these should technically quiet the sNaN and return INVALID. + (<$f>::SNAN, <$f>::SNAN, Status::OK), + (<$f>::NEG_SNAN, <$f>::NEG_SNAN, Status::OK), // with rounding (0.1, 0.0, Status::INEXACT), (-0.1, -0.0, Status::INEXACT), diff --git a/rustc-ice-2026-04-08T07_16_50-190622.txt b/rustc-ice-2026-04-08T07_16_50-190622.txt new file mode 100644 index 000000000..1ebe45b05 --- /dev/null +++ b/rustc-ice-2026-04-08T07_16_50-190622.txt @@ -0,0 +1,41 @@ +thread 'rustc' panicked at /rustc-dev/bcded331651b60a0383b3ff51db4f24c4495ac53/compiler/rustc_middle/src/query/on_disk_cache.rs:663:9: +cannot decode `AttrId` with `CacheDecoder` +stack backtrace: + 0: 0x77d8101b906b - ::create + 1: 0x77d8101b8fb5 - ::force_capture + 2: 0x77d80f1d3c8b - std[7d30a76dffadf049]::panicking::update_hook::>::{closure#0} + 3: 0x77d8101cbb62 - std[7d30a76dffadf049]::panicking::panic_with_hook + 4: 0x77d8101ae60a - std[7d30a76dffadf049]::panicking::panic_handler::{closure#0} + 5: 0x77d8101a2b39 - std[7d30a76dffadf049]::sys::backtrace::__rust_end_short_backtrace:: + 6: 0x77d8101b003d - __rustc[a638a912b495cae0]::rust_begin_unwind + 7: 0x77d80cca951c - core[623525b5c18656f3]::panicking::panic_fmt + 8: 0x77d811d4b22d - ::load_side_effect + 9: 0x77d811d4c78d - >::call_once + 10: 0x77d8108b8cb4 - ::try_mark_previous_green + 11: 0x77d8108b5e69 - ::try_mark_green + 12: 0x77d8108b5cae - rustc_query_impl[44740c00700bfba1]::execution::ensure_can_skip_execution::>> + 13: 0x77d8118023b4 - rustc_query_impl[44740c00700bfba1]::query_impl::check_mod_deathness::execute_query_incr::__rust_end_short_backtrace + 14: 0x77d811801e63 - rustc_interface[aed5607d16a7f406]::passes::analysis::{closure#0}::{closure#0}::{closure#1} + 15: 0x77d811800962 - rustc_data_structures[94965839176f1595]::sync::parallel::par_fns + 16: 0x77d8118008fc - rustc_interface[aed5607d16a7f406]::passes::analysis::{closure#0}::{closure#0} + 17: 0x77d811800962 - rustc_data_structures[94965839176f1595]::sync::parallel::par_fns + 18: 0x77d8108b9ca3 - rustc_interface[aed5607d16a7f406]::passes::analysis + 19: 0x77d811dadabe - rustc_query_impl[44740c00700bfba1]::execution::try_execute_query::>, true> + 20: 0x77d811dad42a - rustc_query_impl[44740c00700bfba1]::query_impl::analysis::execute_query_incr::__rust_end_short_backtrace + 21: 0x77d811a8309e - rustc_interface[aed5607d16a7f406]::interface::run_compiler::<(), rustc_driver_impl[5448826ccd3e97a1]::run_compiler::{closure#0}>::{closure#1} + 22: 0x77d811a386fe - std[7d30a76dffadf049]::sys::backtrace::__rust_begin_short_backtrace::::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> + 23: 0x77d811a38fa0 - ::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[623525b5c18656f3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 24: 0x77d811a39eac - ::new::thread_start + 25: 0x77d80b2a3d64 - start_thread + at ./nptl/pthread_create.c:448:8 + 26: 0x77d80b3373fc - __GI___clone3 + at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0 + 27: 0x0 - + + +rustc version: 1.96.0-nightly (bcded3316 2026-04-06) +platform: x86_64-unknown-linux-gnu + +query stack during panic: +#0 [analysis] running analysis passes on crate `libm` +end of query stack