rust-num / num-integer

Integer trait and functions for Rust
Apache License 2.0
180 stars 48 forks source link

test_lcm_overflow fails on sparc64 #26

Open silwol opened 5 years ago

silwol commented 5 years ago

The build of the Debian package of num-integer 0.1.41 failed test_lcm_overflow on sparc64, it succeeded on the other Debian architectures. Test log can be found at https://buildd.debian.org/status/fetch.php?pkg=rust-num-integer&arch=sparc64&ver=0.1.41-1&stamp=1562827854&raw=0 The relevant output with the backtrace is:

---- test_lcm_overflow stdout ----
thread 'test_lcm_overflow' panicked at 'attempt to multiply with overflow', src/lib.rs:871:27
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::panicking::panic
   9: <u64 as num_integer::Integer>::gcd_lcm
             at src/lib.rs:871
  10: <u64 as num_integer::Integer>::lcm
             at src/lib.rs:860
  11: num_integer::test_lcm_overflow
             at src/lib.rs:1166
  12: num_integer::test_lcm_overflow::{{closure}}
             at src/lib.rs:1138
  13: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.34.2/src/libcore/ops/function.rs:231

I took a quick look at the affected code locations, but I'm not too much into the internals and bit widths of the affected integer types.

silwol commented 5 years ago

Just for the record: https://buildd.debian.org/status/package.php?p=rust-num-integer has a list of the latest build attempts for all architectures.

cuviper commented 5 years ago

Strange that it only occurs on sparc64, and only on the last line of that test. It really seems like it's going to be a codegen issue for that target -- which would be a bug for rustc (or llvm), not here.

Can you debug-print those values that are being multiplied? (src/lib.rs:871)