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

GHC ghc-devs at haskell.org
Fri Jun 26 01:06:41 UTC 2015


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

 {{{
 $ ghc -e 'Data.Bits.shiftL 1 (-1)'
 -9223372036854775808
 $ ghc -e 'Data.Bits.shiftL 2 (-1)'
 zsh: segmentation fault  ghc -e 'Data.Bits.shiftL 2 (-1)'
 $ ghc -e 'Data.Bits.shiftL 100 (-1)'
 zsh: segmentation fault  ghc -e 'Data.Bits.shiftL 100 (-1)'
 }}}

 This also happens with a compiled program. It doesn't with {{{shiftR}}} in
 either case though.

 Side notes:

 - On OS X, when the first operand is also negative, I get a {{{bus
 error}}} instead of a {{{segmentation fault}}}. Linux gives
 {{{segmentation fault}}} on both.
 - On Linux, you have to use {{{ghci}}} instead of {{{-e}}}, for some
 (probably unrelated?) reason).

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


More information about the ghc-tickets mailing list