PR libstdc++/81173 fix undefined memset with null pointer

PR libstdc++/81173
	* include/bits/stl_bvector.h (vector<bool>::_M_initialize_value):
	Do not pass null pointer to memset.

From-SVN: r249554
This commit is contained in:
Jonathan Wakely 2017-06-22 15:16:38 +01:00 committed by Jonathan Wakely
parent 0759db190d
commit b6d03af0b1
2 changed files with 21 additions and 14 deletions

View File

@ -1,3 +1,9 @@
2017-06-22 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/81173
* include/bits/stl_bvector.h (vector<bool>::_M_initialize_value):
Do not pass null pointer to memset.
2017-06-21 Ville Voutilainen <ville.voutilainen@gmail.com>
PR libstdc++/80675

View File

@ -1129,8 +1129,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
void
_M_initialize_value(bool __x)
{
__builtin_memset(this->_M_impl._M_start._M_p, __x ? ~0 : 0,
(this->_M_impl._M_end_addr() - this->_M_impl._M_start._M_p)
if (_Bit_type* __p = this->_M_impl._M_start._M_p)
__builtin_memset(__p, __x ? ~0 : 0,
(this->_M_impl._M_end_addr() - __p)
* sizeof(_Bit_type));
}