This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
vector<bool> does addressof(*ptr) where ptr is returned by allocate(n), but if n==0 that pointer might not be dereferencable. While testing the fix I also found some bugs in the __gnu_test::PointerBase helper that needed correcting. PR libstdc++/80893 * include/bits/stl_bvector.h (vector<bool>::_M_initialize): Avoid null pointer dereference when size is zero. * testsuite/23_containers/vector/bool/80893.cc: New. * testsuite/util/testsuite_allocator.h (PointerBase::PointerBase): Add non-explicit constructor from nullptr. (PointerBase::derived() const): Add const-qualified overload. Tested powerpc64le-linux, committed to trunk.
Attachment:
patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |