https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81173
Bug ID: 81173 Summary: bootstrap-ubsan errors in stl_bvector.h Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- During bootstrap-ubsan I'm seeing hundreds of errors like: .../gcc/obj16a/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_bvector.h:1132:18: runtime error: null pointer passed as argument 1, which is declared to never be null This is from std::vector<bool>(0) where it in the end calls __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) * sizeof(_Bit_type)); and thus memset (NULL, 0, 0); which is UB.