[GHC] #4910: mkStdGen (-2^31) is ⊥

GHC cvs-ghc at haskell.org
Fri Jan 21 08:11:05 CET 2011


#4910: mkStdGen (-2^31) is ⊥
---------------------------------+------------------------------------------
    Reporter:  ion1              |       Owner:                             
        Type:  bug               |      Status:  new                        
    Priority:  normal            |   Component:  libraries/random           
     Version:                    |    Keywords:                             
    Testcase:                    |   Blockedby:                             
          Os:  Unknown/Multiple  |    Blocking:                             
Architecture:  Unknown/Multiple  |     Failure:  Incorrect result at runtime
---------------------------------+------------------------------------------
 Quoting System/Random.hs:

 {{{
 mkStdGen32 :: Int32 -> StdGen
 mkStdGen32 s
  | s < 0     = mkStdGen32 (-s)
 }}}

 Alas, the fact that…

 {{{
 ghci> (minBound :: Data.Int.Int32) == negate minBound
 True
 }}}

 …results in mkStdGen32 going into infinite recursion when applied to the
 minBound of Int32.

 The proposed patch should fix the issue.

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



More information about the Glasgow-haskell-bugs mailing list