Make function intToSBigNat# preserve sign (fixes #14085)
authorOlivier Chéron <olivier.cheron@gmail.com>
Thu, 17 Aug 2017 14:32:28 +0000 (10:32 -0400)
committerBen Gamari <ben@smart-cactus.org>
Thu, 17 Aug 2017 20:42:55 +0000 (16:42 -0400)
commitc5605ae00e9bff90db7a5f24ff3b8de2aba3b55b
tree8d40fce633ea361a369c6acbe14bbc73bb943e5f
parent038534755b1040470453e82531d698a952d4dd05
Make function intToSBigNat# preserve sign (fixes #14085)

Impacts only functions gcdExtInteger, powModInteger and
recipModInteger which gave invalid results on negative S# inputs.

Also fixes gcdExtInteger assertion when first argument is negative.

Test Plan: Updated test case integerGmpInternals

Reviewers: austin, hvr, goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14085

Differential Revision: https://phabricator.haskell.org/D3826
libraries/integer-gmp/cbits/wrappers.c
libraries/integer-gmp/src/GHC/Integer/Type.hs
testsuite/tests/lib/integer/integerGmpInternals.hs
testsuite/tests/lib/integer/integerGmpInternals.stdout