Created attachment 1294 [details] Test caase When I use std.BigInt to calculate the 939970th Fibonacci number, it works, returning an integer with 196443 digits. However, when I try to calculate the 939971st Fibonacci number, I get an assertion failure in debug mode: core.exception.AssertError@/home/demetri/bin/ldc/runtime/phobos/std/internal/math/biguintcore.d(1750): Bigint Internal Error: Asymmetric Karatsuba and a segfault in release mode. Stack trace: #0 0x0000003c51b492e6 in __memcpy_ssse3_back () from /lib64/libc.so.6 #1 0x0000000000439ee8 in std.internal.math.biguintcore.inplaceSub() () #2 0x0000000000438b50 in std.internal.math.biguintcore.mulKaratsuba() () #3 0x0000000000438d29 in std.internal.math.biguintcore.mulKaratsuba() () #4 0x0000000000437544 in std.internal.math.biguintcore.mulInternal() () #5 0x0000000000436fff in std.internal.math.biguintcore.BigUint.mul() () #6 0x000000000040440a in std.bigint.BigInt.__T8opBinaryVAyaa1_2aTS3std6bigint6BigIntZ.opBinary() () #7 0x0000000000404a65 in getints.fibonacci() () #8 0x0000000000403ad6 in getints.fibonacci() () #9 0x0000000000402f78 in D main () #10 0x00000000004586aa in rt.dmain2._d_run_main() () #11 0x00000000004582c6 in _d_run_main () #12 0x0000003c51a21b45 in __libc_start_main () from /lib64/libc.so.6 #13 0x0000000000402db9 in _start ()
Created attachment 1320 [details] Reduced test
This might be same (or related) with the newly reported bug #16264 ( https://issues.dlang.org/show_bug.cgi?id=16264 ). Bug #16264 has a slightly more reduced test case and a table of affected operand sizes.
Anyone still watching this?
Yes. Sadly I've no time to work on it currently. But this bug (and the related #16264) is a blocker to serious use of D's BigInt.
closed by https://github.com/dlang/phobos/pull/5715