gcc/libstdc++-v3/testsuite
Jonathan Wakely 632183ddcc libstdc++: Avoid stack overflow in std::vector (PR 94540)
The std::__uninitialized_default_n algorithm used by std::vector creates
an initial object as a local variable then copies that into the
destination range. If the object is too large for the stack this
crashes. We should create the first object directly into the
destination and then copy it from there.

This doesn't fix the bug for C++98, because in that case the initial
value is created as a default argument of the vector constructor i.e. in
the user's code, not inside libstdc++. We can't prevent that.

	PR libstdc++/94540
	* include/bits/stl_uninitialized.h (__uninitialized_default_1<true>):
	Construct the first value at *__first instead of on the stack.
	(__uninitialized_default_n_1<true>): Likewise.
	Improve comments on several of the non-standard algorithms.
	* testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc:
	New test.
	* testsuite/23_containers/vector/cons/94540.cc: New test.
2020-06-17 22:49:06 +01:00
..
17_intro libstdc++: Add more tests for _E10, _E11 etc. (PR 94901) 2020-05-01 14:49:48 +01:00
18_support libstdc++: Add new testcase for comparison category types 2020-05-27 13:14:17 +01:00
19_diagnostics
20_util libstdc++: Avoid stack overflow in std::vector (PR 94540) 2020-06-17 22:49:06 +01:00
21_strings libstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20 2020-06-15 14:31:26 +01:00
22_locale
23_containers libstdc++: Avoid stack overflow in std::vector (PR 94540) 2020-06-17 22:49:06 +01:00
24_iterators libstdc++: Define converting assignment operator for std::move_iterator 2020-06-09 22:16:24 +01:00
25_algorithms libstdc++: Fix some ranges algos optimizations [PR95578] 2020-06-10 17:37:53 -04:00
26_numerics libstdc++: Use RDRAND as fallback if RDSEED keeps failing (PR 94087) 2020-05-19 23:04:45 +01:00
27_io libstdc++: Fix istream::ignore discarding too many chars (PR 94749) 2020-06-11 18:41:37 +01:00
28_regex libstdc++: Add comparison operators for string and regex types 2020-04-17 16:40:11 +01:00
29_atomics libstdc++: Enforce copyable/movable checks in std::atomic 2020-06-16 22:34:55 +01:00
30_threads libstdc++: Update value of __cpp_lib_jthread macro 2020-04-22 22:54:34 +01:00
abi
backward
config
data
decimal
experimental libstdc++: Fix net::basic_socket::close(error_code&) 2020-05-21 00:59:55 +01:00
ext libstdc++: Avoid errors in allocator's noexcept-specifier (PR 89510) 2020-04-30 16:01:43 +01:00
lib libstdc++: Fix PSTL tests to run correctly with newer Thread Building Blocks 2020-04-21 01:05:13 -07:00
libstdc++-abi
libstdc++-dg
libstdc++-prettyprinters
libstdc++-xmethods
performance
special_functions
std libstdc++: Fix view adaptors for mixed-const sentinels and iterators (PR 95322) 2020-05-27 22:08:15 +01:00
tr1
tr2
util libstdc++: Make std::copy_n work with negative and non-integral sizes 2020-06-04 14:21:34 +01:00
Makefile.am libstdc++: Enable simple invocation of runtest in testsuite 2020-05-21 14:16:19 +01:00
Makefile.in libstdc++: Enable simple invocation of runtest in testsuite 2020-05-21 14:16:19 +01:00