gcc/libstdc++-v3/include/debug
François Dumont cc79682046 libstdc++: [_GLIBCXX_DEBUG] Fix management of __dp_sign_max_size [PR 99402]
__dp_sign precision indicates that we found out what iterator comes first or
last in the range. __dp_sign_max_size is the same plus it gives the information
of the max size of the range that is to say the max_size value such that
distance(lhs, rhs) < max_size.
Thanks to this additional information we are able to tell when a copy of n elements
to that range will fail even if we do not know exactly how large it is.

This patch makes sure that we are properly using this information.

libstdc++-v3/ChangeLog:

	PR libstdc++/99402
	* include/debug/helper_functions.h (__can_advance(_InputIterator,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	(__can_advance(const _Safe_iterator<>&,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	* include/debug/macros.h (__glibcxx_check_can_increment_dist): New,
	use latter.
	(__glibcxx_check_can_increment_range): Adapt to use latter.
	(__glibcxx_check_can_decrement_range): Likewise.
	* include/debug/safe_iterator.h
	(_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&,
	int)): New.
	(__can_advance(const _Safe_iterator<>&,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	* include/debug/safe_iterator.tcc
	(_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&,
	int)): New.
	(_Safe_iterator<>::_M_valid_range(const _Safe_iterator<>&,
	std::pair<difference_type, _Distance_precision>&, bool)): Adapt for
	__dp_sign_max_size.
	(__copy_move_a): Adapt to use __glibcxx_check_can_increment_dist.
	(__copy_move_backward_a): Likewise.
	(__equal_aux): Likewise.
	* include/debug/stl_iterator.h (__can_advance(const std::reverse_iterator<>&,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	(__can_advance(const std::move_iterator<>&,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	* testsuite/25_algorithms/copy/debug/99402.cc: New test.
2021-04-09 21:46:35 +02:00
..
assertions.h libstdc++: Fix headers that can't be used as header units [PR 99413] 2021-03-10 15:27:41 +00:00
bitset
debug.h
deque
formatter.h
forward_list libstdc++: _GLIBCXX_DEBUG Fix allocator-extended move constructor 2021-03-28 22:06:33 +02:00
functions.h
helper_functions.h libstdc++: [_GLIBCXX_DEBUG] Fix management of __dp_sign_max_size [PR 99402] 2021-04-09 21:46:35 +02:00
list libstdc++: _GLIBCXX_DEBUG Fix allocator-extended move constructor 2021-03-28 22:06:33 +02:00
macros.h libstdc++: [_GLIBCXX_DEBUG] Fix management of __dp_sign_max_size [PR 99402] 2021-04-09 21:46:35 +02:00
map
map.h
multimap.h
multiset.h
safe_base.h
safe_container.h
safe_iterator.h libstdc++: [_GLIBCXX_DEBUG] Fix management of __dp_sign_max_size [PR 99402] 2021-04-09 21:46:35 +02:00
safe_iterator.tcc libstdc++: [_GLIBCXX_DEBUG] Fix management of __dp_sign_max_size [PR 99402] 2021-04-09 21:46:35 +02:00
safe_local_iterator.h
safe_local_iterator.tcc
safe_sequence.h
safe_sequence.tcc
safe_unordered_base.h
safe_unordered_container.h
safe_unordered_container.tcc
set
set.h
stl_iterator.h libstdc++: [_GLIBCXX_DEBUG] Fix management of __dp_sign_max_size [PR 99402] 2021-04-09 21:46:35 +02:00
string libstdc++: Fix and complete __gnu_debug::basic_string implementation 2021-03-25 21:56:14 +01:00
unordered_map libstdc++: Add unordered containers heterogeneous lookup 2021-02-09 21:56:27 +01:00
unordered_set libstdc++: Add unordered containers heterogeneous lookup 2021-02-09 21:56:27 +01:00
vector libstdc++: _GLIBCXX_DEBUG Fix allocator-extended move constructor 2021-03-28 22:06:33 +02:00