[Issue 18434] New: Failing case of BigInt gcd
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 13 19:50:50 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18434
Issue ID: 18434
Summary: Failing case of BigInt gcd
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: hsteoh at quickfur.ath.cx
Code:
------
import std.bigint;
import std.numeric;
void main() {
auto g1 = gcd(0, 1); // OK
auto g2 = gcd(BigInt(0), BigInt(1)); // NG
}
------
Output:
------
core.exception.AssertError@/usr/src/d/phobos/std/numeric.d(2699): Assertion
failure
----------------
??:? _d_assertp [0xc9cf7171]
??:? pure nothrow std.bigint.BigInt
std.numeric.gcd!(std.bigint.BigInt).gcd(std.bigint.BigInt, std.bigint.BigInt)
[0xc9cf5770]
??:? _Dmain [0xc9cf5079]
------
The offending line in std.numeric is in the `static if (canUseBinaryGcd)`
block, in the do-loop:
-----
assert((a & 1) != 0);
-----
--
More information about the Digitalmars-d-bugs
mailing list