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

GHC ghc-devs at haskell.org
Sat Jun 27 21:50:10 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 rwbarton):

 I know `unsafeShiftL` has "unsafe" in the name, but it seems irresponsible
 to segfault on a negative argument when it would take one additional
 instruction to test for a negative shift (`shiftLInteger` already checks
 whether the shift is 0) in a function that is not cheap to begin with and
 is exposed as a "public" part of the `Data.Bits` API.

 The `Int` instance of `unsafeShiftL` is sensible because the cost of
 testing whether the shift is in range could exceed the cost of actually
 doing the shift. That doesn't apply here to `Integer`.

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


More information about the ghc-tickets mailing list