diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-10-05 15:16:58 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-10-05 15:18:56 +0100 |
commit | f92a504fdd943527687faf9557e0b39ff7fe6125 (patch) | |
tree | 007b6dfe3b0578c5f19eff0875b9725996def695 /libstdc++-v3/config/abi/pre/gnu.ver | |
parent | 717e402dbf55e7da83d4fc87641ab9e60d4846cb (diff) | |
download | gcc-f92a504fdd943527687faf9557e0b39ff7fe6125.zip gcc-f92a504fdd943527687faf9557e0b39ff7fe6125.tar.gz gcc-f92a504fdd943527687faf9557e0b39ff7fe6125.tar.bz2 |
libstdc++: Make allocators throw bad_array_new_length on overflow [LWG 3190]
std::allocator and std::pmr::polymorphic_allocator should throw
std::bad_array_new_length from their allocate member functions if the
number of bytes required cannot be represented in std::size_t.
libstdc++-v3/ChangeLog:
* config/abi/pre/gnu.ver: Add new symbol.
* include/bits/functexcept.h (__throw_bad_array_new_length):
Declare new function.
* include/ext/malloc_allocator.h (malloc_allocator::allocate):
Throw bad_array_new_length for impossible sizes (LWG 3190).
* include/ext/new_allocator.h (new_allocator::allocate):
Likewise.
* include/std/memory_resource (polymorphic_allocator::allocate)
(polymorphic_allocator::allocate_object): Use new function,
__throw_bad_array_new_length.
* src/c++11/functexcept.cc (__throw_bad_array_new_length):
Define.
* testsuite/20_util/allocator/lwg3190.cc: New test.
Diffstat (limited to 'libstdc++-v3/config/abi/pre/gnu.ver')
-rw-r--r-- | libstdc++-v3/config/abi/pre/gnu.ver | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 87a48a2..6a2b2da 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -2322,6 +2322,9 @@ GLIBCXX_3.4.29 { # std::__atomic_futex_unsigned_base::_M_futex_wait_until_steady _ZNSt28__atomic_futex_unsigned_base26_M_futex_wait_until_steady*; + # std::__throw_bad_array_new_length() + _ZSt28__throw_bad_array_new_lengthv; + } GLIBCXX_3.4.28; # Symbols in the support library (libsupc++) have their own tag. |