[Bug c++/80839] New: Memory leak in _Rb_tree
mail at kitsu dot me
gcc-bugzilla@gcc.gnu.org
Sat May 20 11:56:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80839
Bug ID: 80839
Summary: Memory leak in _Rb_tree
Product: gcc
Version: 6.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mail at kitsu dot me
Target Milestone: ---
Greetings!
I want to use static const std::map with aggregate initialization. The simpler
example of my case is:
#include <map>
int main() {
static const std::map<int, int> a {{1,2}};
return 0;
}
Besides I also want to use clang's memory sanitizer, so the compilation line
is:
clang++ a.cc -fsanitize=memory -std=c++11
And after launch, memory sanitizer complain about use-of-uninitialized-value
(filepaths removed):
==7422==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x493408 in std::_Rb_tree<int, std::pair<int const, int>,
std::_Select1st<std::pair<int const, int> >, std::less<int>,
std::allocator<std::pair<int const, int> >
>::_M_erase(std::_Rb_tree_node<std::pair<int const, int> >*)
#1 0x49349f in std::_Rb_tree<int, std::pair<int const, int>,
std::_Select1st<std::pair<int const, int> >, std::less<int>,
std::allocator<std::pair<int const, int> >
>::_M_erase(std::_Rb_tree_node<std::pair<int const, int> >*)
#2 0x493214 in std::_Rb_tree<int, std::pair<int const, int>,
std::_Select1st<std::pair<int const, int> >, std::less<int>,
std::allocator<std::pair<int const, int> > >::~_Rb_tree()
#3 0x493161 in std::map<int, int, std::less<int>,
std::allocator<std::pair<int const, int> > >::~map()
#4 0x4220a3 in MSanAtExitWrapper(void*)
#5 0x7f933520f6bf in __run_exit_handlers
#6 0x7f933520f719 in __GI_exit
#7 0x7f93351f9517 in __libc_start_main
#8 0x41a1b9 in _start
SUMMARY: MemorySanitizer: use-of-uninitialized-value in std::_Rb_tree<int,
std::pair<int const, int>, std::_Select1st<std::pair<int const, int> >,
std::less<int>, std::allocator<std::pair<int const, int> >
>::_M_erase(std::_Rb_tree_node<std::pair<int const, int> >*)
Exiting
Compiling with debug symbols seems to lead somewhere around here:
https://github.com/gcc-mirror/gcc/blob/gcc-6-branch/libstdc++-v3/include/bits/stl_tree.h#L1633
System info:
Linux: Arch Linux, kernel 4.11.2 + pf-patch
clang: 4.0.0 (last one from off repo)
gcc: 6.3.1 (last one from off repo)
More information about the Gcc-bugs
mailing list