https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87544

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |libstdc++

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
This seems to be the usual issue which starts with max_size returning a bad
value. The default allocator returns size_t(-1) / sizeof(_Tp), when it should
return PTRDIFF_MAX / sizeof(_Tp). There is some code looking at PTRDIFF_MAX,
but it seems to be at the wrong level (number of elements vs number of bytes).

(we are starting to have a lot of code checking for potential overflow in many
different ways in std::vector, I wonder how much this costs at runtime and if
we will need a way to disable it for people who care about performance,
redefining __throw_bad_alloc as __builtin_unreachable only removes part of the
overhead)

Reply via email to