This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/80893] std::vector<bool> creation dereferences null pointer
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 30 May 2017 16:14:33 +0000
- Subject: [Bug libstdc++/80893] std::vector<bool> creation dereferences null pointer
- Auto-submitted: auto-generated
- References: <bug-80893-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80893
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-05-30
Ever confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed when using the pool allocator:
#include <vector>
#include <ext/pool_allocator.h>
int main() {
// OK
std::vector<bool, __gnu_cxx::__pool_alloc<bool>> a;
// Fails.
std::vector<bool, __gnu_cxx::__pool_alloc<bool>> b(a);
// Fails.
std::vector<bool, __gnu_cxx::__pool_alloc<bool>> c(0);
(void)a;
(void)b;
(void)c;
}
tmp$ ~/gcc/7.1.0/bin/g++ vb.cc -fsanitize=undefined -O
tmp$ ./a.out
/home/jwakely/gcc/7.1.0/include/c++/7.1.0/bits/stl_bvector.h:1094:7: runtime
error: reference binding to null pointer of type 'long unsigned int'
/home/jwakely/gcc/7.1.0/include/c++/7.1.0/bits/stl_bvector.h:1094:7: runtime
error: reference binding to null pointer of type 'long unsigned int'