[PATCH] D17377: [ADT]Fix AddPointer() in FoldingSet

Eugene via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 06:37:33 PST 2016


kevgs created this revision.
kevgs added a subscriber: llvm-commits.
kevgs set the repository for this revision to rL LLVM.

Put a pointer value instead of some garbage from stack to hash buffer.

Repository:
  rL LLVM

http://reviews.llvm.org/D17377

Files:
  lib/Support/FoldingSet.cpp

Index: lib/Support/FoldingSet.cpp
===================================================================
--- lib/Support/FoldingSet.cpp
+++ lib/Support/FoldingSet.cpp
@@ -54,8 +54,7 @@
   // depend on the host. It doesn't matter, however, because hashing on
   // pointer values is inherently unstable. Nothing should depend on the
   // ordering of nodes in the folding set.
-  Bits.append(reinterpret_cast<unsigned *>(&Ptr),
-              reinterpret_cast<unsigned *>(&Ptr+1));
+  AddInteger((unsigned long)Ptr);
 }
 void FoldingSetNodeID::AddInteger(signed I) {
   Bits.push_back(I);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17377.48310.patch
Type: text/x-patch
Size: 585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160218/d41b9f09/attachment.bin>


More information about the llvm-commits mailing list