On Mon, 17 Feb 2025 at 21:27, François Dumont <frs.dum...@gmail.com> wrote: > > Ping for this bug fix, would you like a PR ?
No, I don't think we need one, I'm reviewing the patch now. > > On 20/01/2025 22:12, François Dumont wrote: > > Hi > > > > In my work on fancy pointer support I've decided to always cache the > > hash code. > > > > Doing so I spotted a bug in the management of this cache when hash > > functor is stateful. > > > > libstdc++: [_Hashtable] Fix hash code cache usage when hash > > functor is stateful > > > > It is wrong to reuse a cached hash code when this code depends > > then on the state > > of the Hash functor. > > > > Add checks that Hash functor is stateless before reusing the > > cached hash code. > > > > libstdc++-v3/ChangeLog: > > > > * include/bits/hashtable_policy.h > > (_Hash_code_base::_M_copy_code): Remove. > > * include/bits/hashtable.h (_M_copy_code): New. > > (_M_assign): Use latter. > > (_M_bucket_index_ex): New. > > (_M_equals): Use latter. > > * testsuite/23_containers/unordered_map/modifiers/merge.cc > > (test10): New > > test case. > > > > Tested under Linux x64, ok to commit ? > > > > François >