Seen on Debian with gcc 10.2.1-6...
==46129==ERROR: AddressSanitizer: heap-use-after-free on address 0x6020000001f8 at pc 0x555f2a6d9a25 bp 0x7ffe8b65dcf0 sp 0x7ffe8b65dce8
READ of size 4 at 0x6020000001f8 thread T0
#0 0x555f2a6d9a24 in std::__detail::_Hash_code_base<int, std::pair<int const, int>, std::__detail::_Select1st, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, false>::_M_bucket_index(std::__detail::_Hash_node<std::pair<int const, int>, false> const*, unsigned long) const /usr/include/c++/10/bits/hashtable_policy.h:1307
#1 0x555f2a6d8087 in std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_bucket_index(std::__detail::_Hash_node<std::pair<int const, int>, false>*) const /usr/include/c++/10/bits/hashtable.h:678
#2 0x555f2a6d6da2 in std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_move_assign(std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >&&, std::integral_constant<bool, true>) /usr/include/c++/10/bits/hashtable.h:1238
#3 0x555f2a6d5167 in std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::operator=(std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >&&) /usr/include/c++/10/bits/hashtable.h:519
#4 0x555f2a6d3b7c in std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >::operator=(std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >&&) /usr/include/c++/10/bits/unordered_map.h:275
#5 0x555f2a6d3ba6 in zezax::red::DefaultMap<int, int>::operator=(zezax::red::DefaultMap<int, int>&&) ../include/DefaultMap.h:10
#6 0x555f2a6d26f5 in DefaultMap_smoke_Test::TestBody() /home/ameyer/github/one/quol/red/test/defaultmap.cpp:29
#7 0x555f2a7088b6 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0x448b6)
#8 0x555f2a6fd42d in testing::Test::Run() (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0x3942d)
#9 0x555f2a6fd584 in testing::TestInfo::Run() (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0x39584)
#10 0x555f2a6fda18 in testing::TestSuite::Run() (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0x39a18)
#11 0x555f2a6fe061 in testing::internal::UnitTestImpl::RunAllTests() (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0x3a061)
#12 0x555f2a708e26 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0x44e26)
#13 0x555f2a6fd647 in testing::UnitTest::Run() (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0x39647)
#14 0x555f2a6d0f0f in main (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0xcf0f)
#15 0x7fbea63abd09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)
#16 0x555f2a6d1379 in _start (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0xd379)
0x6020000001f8 is located 8 bytes inside of 16-byte region [0x6020000001f0,0x602000000200)
freed by thread T0 here:
#0 0x7fbea6955467 in operator delete(void*, unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:172
#1 0x555f2a6dbb1f in __gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> >::deallocate(std::__detail::_Hash_node<std::pair<int const, int>, false>*, unsigned long) /usr/include/c++/10/ext/new_allocator.h:133
#2 0x555f2a6daa38 in std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> >::deallocate(std::__detail::_Hash_node<std::pair<int const, int>, false>*, unsigned long) /usr/include/c++/10/bits/allocator.h:187
#3 0x555f2a6daa38 in std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> > >::deallocate(std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> >&, std::__detail::_Hash_node<std::pair<int const, int>, false>*, unsigned long) /usr/include/c++/10/bits/alloc_traits.h:492
#4 0x555f2a6d9acc in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> > >::_M_deallocate_node_ptr(std::__detail::_Hash_node<std::pair<int const, int>, false>*) /usr/include/c++/10/bits/hashtable_policy.h:2064
#5 0x555f2a6d8117 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<int const, int>, false>*) /usr/include/c++/10/bits/hashtable_policy.h:2054
#6 0x555f2a6d62b3 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<int const, int>, false>*) /usr/include/c++/10/bits/hashtable_policy.h:2075
#7 0x555f2a6d6a9c in std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_move_assign(std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >&&, std::integral_constant<bool, true>) /usr/include/c++/10/bits/hashtable.h:1219
#8 0x555f2a6d5167 in std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::operator=(std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >&&) /usr/include/c++/10/bits/hashtable.h:519
#9 0x555f2a6d3b7c in std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >::operator=(std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >&&) /usr/include/c++/10/bits/unordered_map.h:275
#10 0x555f2a6d3ba6 in zezax::red::DefaultMap<int, int>::operator=(zezax::red::DefaultMap<int, int>&&) ../include/DefaultMap.h:10
#11 0x555f2a6d26f5 in DefaultMap_smoke_Test::TestBody() /home/ameyer/github/one/quol/red/test/defaultmap.cpp:29
#12 0x555f2a7088b6 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0x448b6)
previously allocated by thread T0 here:
#0 0x7fbea6954647 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
#1 0x555f2a6dbaee in __gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> >::allocate(unsigned long, void const*) /usr/include/c++/10/ext/new_allocator.h:115
#2 0x555f2a6da881 in std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> >::allocate(unsigned long) /usr/include/c++/10/bits/allocator.h:173
#3 0x555f2a6da881 in std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> > >::allocate(std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> >&, unsigned long) /usr/include/c++/10/bits/alloc_traits.h:460
#4 0x555f2a6d991b in std::__detail::_Hash_node<std::pair<int const, int>, false>* std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> > >::_M_allocate_node<std::pair<int const, int> const&>(std::pair<int const, int> const&) /usr/include/c++/10/bits/hashtable_policy.h:2032
#5 0x555f2a6d801d in std::__detail::_Hash_node<std::pair<int const, int>, false>* std::__detail::_AllocNode<std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> > >::operator()<std::pair<int const, int> const&>(std::pair<int const, int> const&) const /usr/include/c++/10/bits/hashtable_policy.h:167
#6 0x555f2a6d5fb7 in void std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_assign<std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> > const&, std::__detail::_AllocNode<std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> > > >(std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> > const&, std::__detail::_AllocNode<std::allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> > > const&) /usr/include/c++/10/bits/hashtable.h:1166
#7 0x555f2a6d4ce6 in std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_Hashtable(std::_Hashtable<int, std::pair<int const, int>, std::allocator<std::pair<int const, int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> > const&) /usr/include/c++/10/bits/hashtable.h:1279
#8 0x555f2a6d3ad2 in std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >::unordered_map(std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > > const&) /usr/include/c++/10/bits/unordered_map.h:181
#9 0x555f2a6d3af8 in zezax::red::DefaultMap<int, int>::DefaultMap(zezax::red::DefaultMap<int, int> const&) ../include/DefaultMap.h:10
#10 0x555f2a6d2258 in DefaultMap_smoke_Test::TestBody() /home/ameyer/github/one/quol/red/test/defaultmap.cpp:25
#11 0x555f2a7088b6 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ameyer/github/one/quol/red/_build/test/defaultmap+0x448b6)
SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/c++/10/bits/hashtable_policy.h:1307 in std::__detail::_Hash_code_base<int, std::pair<int const, int>, std::__detail::_Select1st, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, false>::_M_bucket_index(std::__detail::_Hash_node<std::pair<int const, int>, false> const*, unsigned long) const
Shadow bytes around the buggy address:
0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c047fff8000: fa fa 00 fa fa fa 00 00 fa fa 00 fa fa fa 00 fa
0x0c047fff8010: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 04 fa
0x0c047fff8020: fa fa 00 fa fa fa 04 fa fa fa 00 fa fa fa 00 00
=>0x0c047fff8030: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa fd[fd]
0x0c047fff8040: fa fa fd fd fa fa fd fd fa fa fa fa fa fa fa fa
0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==46129==ABORTING
make: *** [Makefile:24: test-defaultmap] Error 1
make: Leaving directory '/home/ameyer/github/one/quol/red/test'