#2223: Int64.toInteger
-----------------------+----------------------------------------------------
    Reporter:  gnezdo  |       Owner:                
        Type:  bug     |      Status:  new           
    Priority:  normal  |   Component:  Runtime System
     Version:  6.8.2   |    Severity:  major         
    Keywords:          |    Testcase:                
Architecture:  x86     |          Os:  Linux         
-----------------------+----------------------------------------------------
 {{{
 GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
 Loading package base ... linking ... done.
 Prelude> 0 == (-1 `Data.Bits.shift` 32 :: Data.Int.Int64)
 False
 Prelude> 0 == toInteger (-1 `Data.Bits.shift` 32 :: Data.Int.Int64)
 True
 -- ^^^ BUG
 }}}

 The problem appears to be in the recently changed
 rts/PrimOps.cmm::int64ToIntegerzh_fast:
 {{{
    if ( hi != 0 && hi != 0xFFFFFFFF )  {
       words_needed = 2;
    } else {
        // minimum is one word
        words_needed = 1;
    }
 }}}

 So, 0xFFFFFFFF00000000 becomes 0.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2223>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to