[commit: ghc] wip/ghc-8.8-merges: Error out of invalid Int/Word bit shifts (0d917db)

git at git.haskell.org git at git.haskell.org
Thu Feb 21 15:09:50 UTC 2019


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

On branch  : wip/ghc-8.8-merges
Link       : http://ghc.haskell.org/trac/ghc/changeset/0d917dbb46f91151314a2d50573d5acd4b70213f/ghc

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

commit 0d917dbb46f91151314a2d50573d5acd4b70213f
Author: Alec Theriault <alec.theriault at gmail.com>
Date:   Thu Jan 10 23:44:04 2019 -0800

    Error out of invalid Int/Word bit shifts
    
    Although the Haddock's for `shiftL` and `shiftR` do require the number
    of bits to be non-negative, we should still check this before calling
    out to primitives (which also have undefined behaviour for negative bit
    shifts).
    
    If a user _really_ wants to bypass checks that the number of bits is
    sensible, they already have the aptly-named `unsafeShiftL`/`unsafeShiftR`
    at their disposal.
    
    See #16111.


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

0d917dbb46f91151314a2d50573d5acd4b70213f
 compiler/prelude/PrelRules.hs |  5 ++---
 libraries/base/Data/Bits.hs   | 22 ++++++++++++++++------
 libraries/base/GHC/Int.hs     | 40 ++++++++++++++++++++++++++++++----------
 libraries/base/GHC/Word.hs    | 40 ++++++++++++++++++++++++++++++----------
 libraries/base/changelog.md   |  4 ++++
 5 files changed, 82 insertions(+), 29 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0d917dbb46f91151314a2d50573d5acd4b70213f


More information about the ghc-commits mailing list