[commit: ghc] master: integer-gmp: Fix #11296 (07b3be7)

git at git.haskell.org git at git.haskell.org
Sun Dec 27 17:47:06 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/07b3be76a14a061a43846ef41f1dd7819603be4e/ghc

>---------------------------------------------------------------

commit 07b3be76a14a061a43846ef41f1dd7819603be4e
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Sun Dec 27 17:49:10 2015 +0100

    integer-gmp: Fix #11296
    
    This was introduced by a mental fumble in
    9e8562ae02701270e2c1dfcee3279d862dc5b7b6 wherein I replaced
    `getSizeofMutableByteArray` with `getSizeofMutBigNat`. This was noticed
    by invalid integers being produced on 32-bit machines in #11296.
    
    Test Plan: Validate
    
    Reviewers: hvr, goldfire, austin
    
    Reviewed By: hvr
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1707
    
    GHC Trac Issues: #11296


>---------------------------------------------------------------

07b3be76a14a061a43846ef41f1dd7819603be4e
 libraries/integer-gmp/src/GHC/Integer/Type.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libraries/integer-gmp/src/GHC/Integer/Type.hs b/libraries/integer-gmp/src/GHC/Integer/Type.hs
index 167492d..3e563dc 100644
--- a/libraries/integer-gmp/src/GHC/Integer/Type.hs
+++ b/libraries/integer-gmp/src/GHC/Integer/Type.hs
@@ -1659,7 +1659,7 @@ resizeMutBigNat# (MBN# mba0#) nsz# s
         (# s'', mba# #) -> (# s'', MBN# mba# #)
   where
     bsz# = nsz# `uncheckedIShiftL#` GMP_LIMB_SHIFT#
-    (# s', n# #) = getSizeofMutBigNat# (MBN# mba0#) s
+    (# s', n# #) = getSizeofMutableByteArray# mba0# s
 
 shrinkMutBigNat# :: MutBigNat s -> GmpSize# -> State# s -> State# s
 shrinkMutBigNat# (MBN# mba0#) nsz# s
@@ -1667,7 +1667,7 @@ shrinkMutBigNat# (MBN# mba0#) nsz# s
   | True                  = shrinkMutableByteArray# mba0# bsz# s'
   where
     bsz# = nsz# `uncheckedIShiftL#` GMP_LIMB_SHIFT#
-    (# s', n# #) = getSizeofMutBigNat# (MBN# mba0#) s
+    (# s', n# #) = getSizeofMutableByteArray# mba0# s
 
 unsafeSnocFreezeBigNat# :: MutBigNat s -> GmpLimb# -> S s BigNat
 unsafeSnocFreezeBigNat# mbn0@(MBN# mba0#) limb# s = go s'



More information about the ghc-commits mailing list