Skip to content

Data.Bits.setBit misbehaves on bad input

While

ghc -e 'Data.Bits.setBit 0 (2^36::Int) :: Integer'

seems to “work” (allocates lots of memory and keeps calculating), it mis-behaves with larger numbers:

$ ghc -e 'Data.Bits.setBit 0 (2^37::Int) :: Integer'
gmp: overflow in mpz type
Abgebrochen

If gmp cannot cope with that number, an exception should be raised, but not the whole process terminated.

Natuarlly, this is not a very critical bug.

Trac metadata
Trac field Value
Version 7.0.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information