This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/87840] LSAN not always printing the leaks when -fsanitize=address is absent
- From: "marxin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Nov 2018 13:55:05 +0000
- Subject: [Bug sanitizer/87840] LSAN not always printing the leaks when -fsanitize=address is absent
- Auto-submitted: auto-generated
- References: <bug-87840-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87840
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
Can't confirm:
$ g++ --version
g++ (GCC) 9.0.0 20181101 (experimental)
$ g++-8 --version
g++-8 (SUSE Linux) 8.2.1 20180831 [gcc-8-branch revision 264010]
$ g++ -ggdb3 pr87840.cpp -fsanitize=leak && ./a.out
=================================================================
==15731==ERROR: LeakSanitizer: detected memory leaks
Indirect leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7ffff74fa7db in operator new(unsigned long)
/home/marxin/Programming/gcc/libsanitizer/lsan/lsan_interceptors.cc:222
#1 0x401c7b in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void
const*) /home/marxin/bin/gcc/include/c++/9.0.0/ext/new_allocator.h:114
#2 0x401b1a in
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >
>::allocate(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>,
(__gnu_cxx::_Lock_policy)2> >&, unsigned long)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/alloc_traits.h:444
#3 0x401963 in
std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> > >
std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >
>(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>,
(__gnu_cxx::_Lock_policy)2> >&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/allocated_ptr.h:97
#4 0x401807 in
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<S,
std::allocator<S>>(std::_Sp_make_shared_tag, S*, std::allocator<S> const&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr_base.h:655
#5 0x401740 in std::__shared_ptr<S,
(__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag,
std::allocator<S> const&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr_base.h:1322
#6 0x4016b0 in
std::shared_ptr<S>::shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag,
std::allocator<S> const&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr.h:360
#7 0x4015b5 in std::shared_ptr<S> std::allocate_shared<S,
std::allocator<S>>(std::allocator<S> const&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr.h:703
#8 0x40147c in std::shared_ptr<S> std::make_shared<S>()
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr.h:719
#9 0x4011b8 in main /home/marxin/Programming/testcases/pr87840.cpp:8
#10 0x7ffff6db8fea in __libc_start_main ../csu/libc-start.c:308
Indirect leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7ffff74fa7db in operator new(unsigned long)
/home/marxin/Programming/gcc/libsanitizer/lsan/lsan_interceptors.cc:222
#1 0x401c7b in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void
const*) /home/marxin/bin/gcc/include/c++/9.0.0/ext/new_allocator.h:114
#2 0x401b1a in
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >
>::allocate(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>,
(__gnu_cxx::_Lock_policy)2> >&, unsigned long)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/alloc_traits.h:444
#3 0x401963 in
std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> > >
std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >
>(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>,
(__gnu_cxx::_Lock_policy)2> >&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/allocated_ptr.h:97
#4 0x401807 in
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<S,
std::allocator<S>>(std::_Sp_make_shared_tag, S*, std::allocator<S> const&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr_base.h:655
#5 0x401740 in std::__shared_ptr<S,
(__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag,
std::allocator<S> const&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr_base.h:1322
#6 0x4016b0 in
std::shared_ptr<S>::shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag,
std::allocator<S> const&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr.h:360
#7 0x4015b5 in std::shared_ptr<S> std::allocate_shared<S,
std::allocator<S>>(std::allocator<S> const&)
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr.h:703
#8 0x40147c in std::shared_ptr<S> std::make_shared<S>()
/home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr.h:719
#9 0x4011ac in main /home/marxin/Programming/testcases/pr87840.cpp:7
#10 0x7ffff6db8fea in __libc_start_main ../csu/libc-start.c:308
SUMMARY: LeakSanitizer: 64 byte(s) leaked in 2 allocation(s).
$ g++-8 -ggdb3 pr87840.cpp -fsanitize=leak && ./a.out
=================================================================
==15808==ERROR: LeakSanitizer: detected memory leaks
Indirect leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7ffff74fa7db in operator new(unsigned long)
/home/marxin/Programming/gcc/libsanitizer/lsan/lsan_interceptors.cc:222
#1 0x401d05 in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void
const*) /usr/include/c++/8/ext/new_allocator.h:111
#2 0x401ba4 in
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >
>::allocate(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>,
(__gnu_cxx::_Lock_policy)2> >&, unsigned long)
/usr/include/c++/8/bits/alloc_traits.h:436
#3 0x4019b5 in
std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> > >
std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >
>(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>,
(__gnu_cxx::_Lock_policy)2> >&) /usr/include/c++/8/bits/allocated_ptr.h:97
#4 0x40181b in
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<S,
std::allocator<S>>(std::_Sp_make_shared_tag, S*, std::allocator<S> const&)
/usr/include/c++/8/bits/shared_ptr_base.h:654
#5 0x401750 in std::__shared_ptr<S,
(__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag,
std::allocator<S> const&) /usr/include/c++/8/bits/shared_ptr_base.h:1322
#6 0x4016c0 in
std::shared_ptr<S>::shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag,
std::allocator<S> const&) /usr/include/c++/8/bits/shared_ptr.h:360
#7 0x4015c5 in std::shared_ptr<S> std::allocate_shared<S,
std::allocator<S>>(std::allocator<S> const&)
/usr/include/c++/8/bits/shared_ptr.h:707
#8 0x40148c in std::shared_ptr<S> std::make_shared<S>()
/usr/include/c++/8/bits/shared_ptr.h:723
#9 0x4011b8 in main /home/marxin/Programming/testcases/pr87840.cpp:8
#10 0x7ffff6db8fea in __libc_start_main ../csu/libc-start.c:308
Indirect leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7ffff74fa7db in operator new(unsigned long)
/home/marxin/Programming/gcc/libsanitizer/lsan/lsan_interceptors.cc:222
#1 0x401d05 in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void
const*) /usr/include/c++/8/ext/new_allocator.h:111
#2 0x401ba4 in
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >
>::allocate(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>,
(__gnu_cxx::_Lock_policy)2> >&, unsigned long)
/usr/include/c++/8/bits/alloc_traits.h:436
#3 0x4019b5 in
std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> > >
std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<S,
std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >
>(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>,
(__gnu_cxx::_Lock_policy)2> >&) /usr/include/c++/8/bits/allocated_ptr.h:97
#4 0x40181b in
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<S,
std::allocator<S>>(std::_Sp_make_shared_tag, S*, std::allocator<S> const&)
/usr/include/c++/8/bits/shared_ptr_base.h:654
#5 0x401750 in std::__shared_ptr<S,
(__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag,
std::allocator<S> const&) /usr/include/c++/8/bits/shared_ptr_base.h:1322
#6 0x4016c0 in
std::shared_ptr<S>::shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag,
std::allocator<S> const&) /usr/include/c++/8/bits/shared_ptr.h:360
#7 0x4015c5 in std::shared_ptr<S> std::allocate_shared<S,
std::allocator<S>>(std::allocator<S> const&)
/usr/include/c++/8/bits/shared_ptr.h:707
#8 0x40148c in std::shared_ptr<S> std::make_shared<S>()
/usr/include/c++/8/bits/shared_ptr.h:723
#9 0x4011ac in main /home/marxin/Programming/testcases/pr87840.cpp:7
#10 0x7ffff6db8fea in __libc_start_main ../csu/libc-start.c:308
SUMMARY: LeakSanitizer: 64 byte(s) leaked in 2 allocation(s).
What version of g++-9 do you have? Note that I did libsanitizer merge
yesterday.