c397f267f1
Previously the _M_Nb member was incremented before calling _M_unchecked_set which meant that the bit being set was out of bounds. It either set the wrong bit in an allocated word, or accessed beyond the end of the allocated memory in the _M_w vector. The fix for the bug is to update the _M_Nb member after using it as an index. As an optimisation, when a new block needs to be appended the call to _M_unchecked_set can be avoided by appending a block with the least significant bit already set to the desired value. PR libstdc++/87784 * include/tr2/dynamic_bitset (dynamic_bitset::push_back): When there are no unused bits in the last block, append a new block with the right value so the bit doesn't need to be set. Only increment size after setting the new bit, not before. * testsuite/tr2/dynamic_bitset/pr87784.cc: New test. From-SVN: r265625 |
||
---|---|---|
.. | ||
bases | ||
direct_bases | ||
dynamic_bitset | ||
headers |