[Bug libstdc++/80285] `std::make_shared` performs two separate allocations with `-fno-rtti`
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 11 13:32:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80285
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu May 11 13:21:07 2017
New Revision: 247905
URL: https://gcc.gnu.org/viewcvs?rev=247905&root=gcc&view=rev
Log:
PR libstdc++/80285 optimize std::make_shared for -fno-rtti
PR libstdc++/80285
* include/bits/shared_ptr_base.h (_Sp_make_shared_tag::_S_ti): Define
function to get unique fake std::type_info reference.
(_Sp_counted_ptr_inplace::_M_get_deleter) [!__cpp_rtti]: Compare to
_S_ti() fake reference.
(__shared_ptr(_Sp_make_shared_tag, const Alloc&, Args&&...)): Share
single implementation with or without RTTI enable.
[!__cpp_rtti]: Pass fake reference to _M_get_deleter.
* testsuite/20_util/shared_ptr/creation/alloc.cc: Change expected
allocation and deallocation counts.
* testsuite/20_util/shared_ptr/creation/single_allocation.cc: New.
* testsuite/20_util/shared_ptr/creation/single_allocation_no_rtti.cc:
New.
Added:
trunk/libstdc++-v3/testsuite/20_util/shared_ptr/creation/single_allocation.cc
trunk/libstdc++-v3/testsuite/20_util/shared_ptr/creation/single_allocation_no_rtti.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/shared_ptr_base.h
trunk/libstdc++-v3/testsuite/20_util/shared_ptr/creation/alloc.cc
More information about the Gcc-bugs
mailing list