[GHC] #5944: Bad hpc hash function
GHC
cvs-ghc at haskell.org
Fri Mar 16 16:00:47 CET 2012
#5944: Bad hpc hash function
------------------------------+---------------------------------------------
Reporter: Lennart | Owner: andy@…
Type: bug | Status: new
Priority: normal | Component: Code Coverage
Version: 7.2.2 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
In the hpc module Trace.Hpc.Util there is the following code:
{{{
instance (HpcHash a,HpcHash b) => HpcHash (a,b) where
toHash (a,b) = toHash a * 33 `hxor` toHash b
}}}
This is bad and I can only presume that what was actually intended was
{{{
instance (HpcHash a,HpcHash b) => HpcHash (a,b) where
toHash (a,b) = (toHash a * 33) `hxor` toHash b
}}}
Otherwise a hash of 0 for a will result in a total hash of 0.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5944>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list