D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 11599 - BigInt crashes on very large operations.
Summary: BigInt crashes on very large operations.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-24 22:04 UTC by supernova2003dh
Modified: 2020-03-21 03:56 UTC (History)
3 users (show)

See Also:


Attachments
Test caase (1.59 KB, text/x-dsrc)
2013-11-24 22:04 UTC, supernova2003dh
Details
Reduced test (79.75 KB, text/x-dsrc)
2014-02-05 17:06 UTC, safety0ff.bugz
Details

Note You need to log in before you can comment on or make changes to this issue.
Description supernova2003dh 2013-11-24 22:04:42 UTC
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 ()
Comment 1 safety0ff.bugz 2014-02-05 17:06:26 UTC
Created attachment 1320 [details]
Reduced test
Comment 2 Kirill Kryukov 2016-07-12 06:17:50 UTC
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 tkook11 2016-08-07 20:20:21 UTC
Anyone still watching this?
Comment 4 Kirill Kryukov 2016-08-08 00:17:31 UTC
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 basile-z 2017-10-28 13:47:16 UTC
closed by https://github.com/dlang/phobos/pull/5715