Ticket #5944 (closed bug: fixed)

Opened 15 months ago

Last modified 15 months ago

Bad hpc hash function

Reported by: Lennart Owned by: simonmar
Priority: high Milestone: 7.4.2
Component: Code Coverage Version: 7.2.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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.

Change History

Changed 15 months ago by simonmar

  • owner changed from andy@… to simonmar
  • difficulty set to Unknown
  • priority changed from normal to high
  • milestone set to 7.4.2

Ok, I'll push the fix. Thanks.

Changed 15 months ago by simonmar

  • status changed from new to merge
commit 4d661848575009bbcf3fe8e1f7c69da12f1d3a8e
Author: Simon Marlow <marlowsd@gmail.com>
Date:   Tue Mar 20 12:12:06 2012 +0000

    fix bug in instance HpcHash (a,b) (GHC ticket #5944)

Changed 15 months ago by pcapriotti

  • status changed from merge to closed
  • resolution set to fixed

Merged as ffd12b9a17dfdffef8ca4dd215e5c081d9b082fa.

Note: See TracTickets for help on using tickets.