Bug 11599 – BigInt crashes on very large operations.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2013-11-24T22:04:42Z
Last change time
2020-03-21T03:56:40Z
Assigned to
No Owner
Creator
supernova2003dh

Attachments

IDFilenameSummaryContent-TypeSize
1294getints.dTest caasetext/x-dsrc1629
1320_11599b.dReduced testtext/x-dsrc81659

Comments

Comment #0 by supernova2003dh — 2013-11-24T22:04:42Z
Created attachment 1294 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 ()
Comment #1 by safety0ff.bugz — 2014-02-05T17:06:26Z
Created attachment 1320 Reduced test
Comment #2 by kkryukov — 2016-07-12T06:17:50Z
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.
Comment #3 by tkook11 — 2016-08-07T20:20:21Z
Anyone still watching this?
Comment #4 by kkryukov — 2016-08-08T00:17:31Z
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.
Comment #5 by b2.temp — 2017-10-28T13:47:16Z