[GHC] #5541: Data.Bits.setBit misbehaves on bad input

GHC cvs-ghc at haskell.org
Sun Oct 9 17:33:01 CEST 2011


#5541: Data.Bits.setBit misbehaves on bad input
---------------------------------+------------------------------------------
    Reporter:  nomeata           |       Owner:               
        Type:  bug               |      Status:  new          
    Priority:  normal            |   Component:  Compiler     
     Version:  7.0.4             |    Keywords:               
    Testcase:                    |   Blockedby:               
          Os:  Unknown/Multiple  |    Blocking:               
Architecture:  Unknown/Multiple  |     Failure:  Runtime crash
---------------------------------+------------------------------------------
 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.

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



More information about the Glasgow-haskell-bugs mailing list