This is the mail archive of the gcc-bugs@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]

[Bug libstdc++/80893] std::vector<bool> creation dereferences null pointer


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'

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]