diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2015-10-10 14:32:28 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-10-10 15:41:05 +0200 |
commit | 182c44da50db028a432a81789048c87922bd30f4 (patch) | |
tree | abc889e99d07c2d1d543cd2f3bb05146ae00c8ee /libraries/base/Data | |
parent | 5d841108acef950fed6a5e608ac9b18e7431aa87 (diff) | |
download | haskell-182c44da50db028a432a81789048c87922bd30f4.tar.gz |
Keep `shift{L,R}` on `Integer` from segfaulting
This can happen because the underlying primitive operations in
`integer-gmp` don't support negative shift-amounts, and since
`integer-gmp` can't throw proper exceptions and just provides a
low-level API, it simply segfaults instead...
This patch simply removes the `shift{L,R}` method definitions (and
defines `unsafeShift{L,R}` instead) whose default-impls fallback on
using `shift` which properly handles negative shift arguments.
This addresses #10571
Test Plan: harbormaster can do it
Reviewers: hvr, austin, rwbarton
Subscribers: rwbarton, thomie, bgamari
Differential Revision: https://phabricator.haskell.org/D1018
GHC Trac Issues: #10571
Diffstat (limited to 'libraries/base/Data')
-rw-r--r-- | libraries/base/Data/Bits.hs | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs index 38025f877c..9134e13ba8 100644 --- a/libraries/base/Data/Bits.hs +++ b/libraries/base/Data/Bits.hs @@ -515,15 +515,7 @@ instance Bits Integer where complement = complementInteger shift x i@(I# i#) | i >= 0 = shiftLInteger x i# | otherwise = shiftRInteger x (negateInt# i#) - shiftL x i@(I# i#) - | i < 0 = error "Bits.shiftL(Integer): negative shift" - | otherwise = shiftLInteger x i# - shiftR x i@(I# i#) - | i < 0 = error "Bits.shiftR(Integer): negative shift" - | otherwise = shiftRInteger x i# - testBit x (I# i) = testBitInteger x i - zeroBits = 0 #if HAVE_INTEGER_GMP1 |