https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70463

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oops, clipboard fail, that's not what I thought I was pasting, this is:

--- a/libstdc++-v3/src/c++11/shared_ptr.cc
+++ b/libstdc++-v3/src/c++11/shared_ptr.cc
@@ -41,7 +41,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     const unsigned char invalid = mask + 1;

     inline unsigned char key(const void* addr)
-    { return _Hash_impl::hash(addr) & mask; }
+    {
+      const int zero_bits = __builtin_ctz(alignof(shared_ptr<void>));
+      return _Hash_impl::hash(uintptr_t(addr) >> zero_bits) & mask;
+    }

     /* Returns different instances of __mutex depending on the passed address
      * in order to limit contention.

Reply via email to