Aatch / ramp

RAMP - Rust Arithmetic in Multiple Precision
Apache License 2.0
261 stars 38 forks source link

ll::test::test_divrem fails sporadically #1

Closed gereeter closed 9 years ago

gereeter commented 9 years ago

On my machine (x86_64, Arch Linux, grsecurity kernel version 4.0.4), ll::test::test_divrem fails sporadically with things like

thread 'll::test::test_divrem' panicked at 'assertion failed: `(left == right)` (left: `[13182838137603728971, 5708230739161860554, 3, 1]`, right: `[1, 3, 4, 1]`)', src/ll/mod.rs:497

Running the test binary through valgrind, I see lots of

==20599== Conditional jump or move depends on uninitialised value(s)
==20599==    at 0x11D32A: ll::addsub::sub_n::hffdbcc24b72e3a8dLda (addsub.rs:71)
==20599==    by 0x12354F: ll::div::sb_div::h35b128adc06803d5nRa (div.rs:239)
==20599==    by 0x1223BE: ll::div::divrem::h0b3da023be4cb42d7La (div.rs:192)
==20599==    by 0x138E53: ll::test::test_divrem::heb2cd3321ec3b338OZd (mod.rs:494)
==20599==    by 0x16BADB: boxed::F.FnBox$LT$A$GT$::call_box::h10806636898263112044 (in /home/jonathan/coding/general/ramp/target/debug/ramp-5a611b79a68508d5)
==20599==    by 0x16EBD7: boxed::F.FnBox$LT$A$GT$::call_box::h7348684160606361188 (in /home/jonathan/coding/general/ramp/target/debug/ramp-5a611b79a68508d5)
==20599==    by 0x16C2C9: rt::unwind::try::try_fn::h13513740954489387225 (in /home/jonathan/coding/general/ramp/target/debug/ramp-5a611b79a68508d5)
==20599==    by 0x1A16C8: rust_try_inner (in /home/jonathan/coding/general/ramp/target/debug/ramp-5a611b79a68508d5)
==20599==    by 0x1A16B5: rust_try (in /home/jonathan/coding/general/ramp/target/debug/ramp-5a611b79a68508d5)
==20599==    by 0x196F07: rt::unwind::try::inner_try::hb6f04bd1baacc20eKnw (in /home/jonathan/coding/general/ramp/target/debug/ramp-5a611b79a68508d5)
==20599==    by 0x16C4FA: boxed::F.FnBox$LT$A$GT$::call_box::h6754105881859822973 (in /home/jonathan/coding/general/ramp/target/debug/ramp-5a611b79a68508d5)
==20599==    by 0x19B391: sys::thread::Thread::new::thread_start::h285dd80d49b81cf50xv (in /home/jonathan/coding/general/ramp/target/debug/ramp-5a611b79a68508d5)

which might be the cause. It's possible that this isn't ramp's fault , however, as I also see a Conditional jump or move depends on uninitialised value(s) in fs::Path.PathExt::exists before anything else.

Aatch commented 9 years ago

Yeah, I've seen that too a few times. I've got no idea what could be causing it though. That backtrace actually helps though. I'll see if I can get to the root cause. It's likely a bug somewhere since I've occasionally had segfaults in the divrem test, didn't think of running it through valgrind though. My C-level debugging skills seem to have gotten a bit rusty (Hah!)

Aatch commented 9 years ago

Fixed by 6b93c475 (I hope).