Int64.toInteger
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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Runtime System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |