gcc/libstdc++-v3/src
Jonathan Wakely 30b41cfbb2 libstdc++: handle small max_blocks_per_chunk in pool resources [PR 94160]
When a pool resource is constructed with max_blocks_per_chunk=1 it ends
up creating a pool with blocks_per_chunk=0 which means it never
allocates anything. Instead it returns null pointers, which should be
impossible.

To avoid this problem, round the max_blocks_per_chunk value to a
multiple of four, so it's never smaller than four.

libstdc++-v3/ChangeLog:

	PR libstdc++/94160
	* src/c++17/memory_resource.cc (munge_options): Round
	max_blocks_per_chunk to a multiple of four.
	(__pool_resource::_M_alloc_pools()): Simplify slightly.
	* testsuite/20_util/unsynchronized_pool_resource/allocate.cc:
	Check that valid pointers are returned when small values are
	used for max_blocks_per_chunk.
2020-09-10 15:42:09 +01:00
..
c++11 libstdc++: Make std::this_thread functions work without gthreads 2020-08-11 16:16:21 +01:00
c++17 libstdc++: handle small max_blocks_per_chunk in pool resources [PR 94160] 2020-09-10 15:42:09 +01:00
c++98 libstdc++: Do not set eofbit eagerly in operator>>(istream&, char(&)[N]) 2020-08-06 19:23:14 +01:00
filesystem libstdc++: Fix build for targets without lstat [PR 94681] 2020-08-10 19:12:12 +01:00
shared Update copyright years. 2020-01-01 12:51:42 +01:00
Makefile.am Update copyright years. 2020-01-01 12:51:42 +01:00
Makefile.in libstdc++: Regenerate makefiles 2020-06-23 07:59:40 +01:00