[LLVMdev] The ComputeHash algorithm in FoldingSet isunsafe

Xu Zhongxing xuzhongxing at foxmail.com
Mon Sep 26 15:19:34 PDT 2011


I should also implement NodeEquals() method. Please ignore this message.
 
 
------------------ Original ------------------
From:  "Xu Zhongxing"<xuzhongxing at foxmail.com>;
Date:  Mon, Sep 26, 2011 10:11 PM
To:  "llvmdev"<llvmdev at cs.uiuc.edu>; 

Subject:  [LLVMdev] [LLVMDev] The ComputeHash algorithm in FoldingSet isunsafe

 
I use FoldingSet to save some data structures. And I found somehow it always abandon a new node. I tracked the bug into the ComputeHash() function of FoldingSet. It computes the SAME hash value for these two 32-bit unsigned integer sequences:


size: 17                                                                                                                                                     
4144534024, 32767, 4146895704, 32767, 4027803688, 32767, 4026983736, 32767, 4147202696, 32767, 4026587256, 32767, 0, 4026589472, 32767, 0, 0,                
size: 16                                                                                                                                                     
4030909168, 32767, 4028631392, 32767, 4029542384, 32767, 0, 4028487592, 32767, 4026587256, 32767, 0, 4026589472, 32767, 0, 0,                                


The hash value is 2111586599                                             


The test code is attached.


What should we do with it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110927/620d06f2/attachment.html>


More information about the llvm-dev mailing list