vector<bool> _M_start and 0 offset
Marc Glisse
marc.glisse@inria.fr
Sat Sep 15 12:27:00 GMT 2018
Hello,
as explained in the PR, the implementation of vector<bool> is weirdly
wasteful. Preserving the ABI prevents from changing much for now, but this
small tweak can help the compiler remove quite a bit of dead code.
I think most other direct uses of _M_start are in constructors where the
offset has just been initialized to 0, so the compiler should already know
enough there, but I may have missed a few relevant places where the same
idea could be used.
I used C++11 syntax because I find it nicer, and the compiler accepts it
in C++98 mode with just a warning, suppressed in a standard header.
Bootstrap+regtest on powerpc64le-unknown-linux-gnu.
2018-09-15 Marc Glisse <marc.glisse@inria.fr>
PR libstdc++/87258
* include/bits/stl_bvector.h (vector::begin(), vector::cbegin()):
Rebuild _M_start with an explicit 0 offset.
--
Marc Glisse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vbool.patch
Type: text/x-diff
Size: 1692 bytes
Desc:
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180915/d4464390/attachment.bin>
More information about the Libstdc++
mailing list