On Mon, 10 Jun 2024 at 05:38, François Dumont <frs.dum...@gmail.com> wrote:
>
> Hi
>
> libstdc++: [_Hashtable] Optimize destructor
>
> Hashtable destructor do not need to call clear() method that in addition to
> destroying all nodes also reset all buckets to nullptr.
>
> libstdc++-v3/ChangeLog:
>
>      * include/bits/hashtable.h (~_Hashtable()): Replace clear call with
>      a _M_deallocate_nodes call.
>
> Tested under Linux x64, ok to commit ?

This will only matter at -O0 because the compiler will optimize out
the memset and zeroing in the destructor, because those are dead
stores.

The call to memset in the destructor is incorrect anyway, that would
be undefined behaviour for fancy pointers of non-trivial type.

OK for trunk.

Reply via email to