https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70463
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-04-05 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This would shift the address right to remove the bits that are always zero: --- a/libstdc++-v3/src/c++11/shared_ptr.cc +++ b/libstdc++-v3/src/c++11/shared_ptr.cc @@ -41,7 +41,9 @@ _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(addzero_bitsaligned) & mask; } /* Returns different instances of __mutex depending on the passed address * in order to limit contention.