[GHC] #10571: GHC 7.10.1 segfaults when shiftL-ing Integers by negative amounts

GHC ghc-devs at haskell.org
Fri Jun 26 17:43:27 UTC 2015


#10571: GHC 7.10.1 segfaults when shiftL-ing Integers by negative amounts
-------------------------------------+-------------------------------------
        Reporter:  anders_           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  MacOS X           |            Architecture:  x86_64
 Type of failure:  Runtime crash     |  (amd64)
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by hvr):

 Right now,

 {{{#!hs
 instance Bits Integer where
    -- ...
    shift x i@(I# i#) | i >= 0    = shiftLInteger x i#
                      | otherwise = shiftRInteger x (negateInt# i#)
    shiftL x (I# i#) = shiftLInteger x i#
    shiftR x (I# i#) = shiftRInteger x i#
    -- ...
 }}}

 The simplest fix would be to simply rename `shift{L,R}` to
 `unsafeShift{L,R}`

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10571#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list