[GHC] #9306: Crash when shifting Integers too far left (was: Crash when shifting Integers too much)

GHC ghc-devs at haskell.org
Sun Jul 13 08:22:09 UTC 2014


#9306: Crash when shifting Integers too far left
-------------------------------------+------------------------------------
        Reporter:  dfeuer            |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  libraries/base    |          Version:  7.8.3
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  Runtime crash     |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------
Description changed by dfeuer:

Old description:

> When shifting an Integer by `fromIntegral (maxBound::Int) + 2` or more,
> the RTS crashes. The attached program gives the following output (on
> x86_64, at least):
>
> [dfeuer at lemur src]$ ./shiftcrash
> Okay 0
> gmp: overflow in mpz type
> Aborted
>
> I found the bug in 7.6.3, but it's been verified to be present also in
> 7.8.3. The crash also occurs when running similar code in GHCi.

New description:

 When shifting an Integer very far left, the RTS crashes. On x86_64:

 Prelude Data.Bits> 1 `shiftL` 100000000000000000000000 == 1
 gmp: overflow in mpz type
 Aborted

 I found the bug in 7.6.3, but it's been verified to be present also in
 7.8.3. The crash also occurs when running similar code compiled by ghc.

--

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


More information about the ghc-tickets mailing list