gcc/libstdc++-v3/include
Jonathan Wakely b9479ddc7a libstdc++: Fix deadlock in debug iterator increment [PR108288]
With -fno-elide-constructors the debug iterator post-increment and
post-decrement operators are susceptible to deadlock. They take a mutex
lock and then return a temporary, which also attempts to take a lock to
attach itself to the sequence. If the return value and *this happen to
collide and use the same mutex from the pool, then you get a deadlock
trying to lock a mutex that is already held by the current thread.

The solution is to construct the return value before taking the lock.
The copy constructor and pre-inc/pre-dec operators already manage locks
correctly, without deadlock, so just implement post-inc/post-dec in the
conventional way, taking a copy then modifying *this, then returning the
copy.

libstdc++-v3/ChangeLog:

	PR libstdc++/108288
	* include/debug/safe_iterator.h (_Safe_iterator::operator++(int))
	(_Safe_iterator::operator--(int)): Do not hold lock around
	construction of return value.
2023-01-06 11:52:01 +00:00
..
backward libstdc++: Add preprocessor conditions for freestanding [PR106953] 2022-09-16 21:47:19 +01:00
bits libstdc++: Add std::format support to <chrono> 2022-12-22 23:34:27 +00:00
c Update copyright years. 2022-01-03 10:42:10 +01:00
c_compatibility libstdc++: Add _Exit to <stdlib.h> for freestanding 2022-09-21 08:44:21 +01:00
c_global libstdc++: Small extended float support tweaks 2022-10-31 16:49:04 +01:00
c_std libstdc++: Declare std::c8rtomb and std::mbrtoc8 if provided by the C library 2022-01-18 16:31:02 +00:00
debug libstdc++: Fix deadlock in debug iterator increment [PR108288] 2023-01-06 11:52:01 +00:00
decimal Update copyright years. 2022-01-03 10:42:10 +01:00
experimental contracts: Lowercase {MAYBE,NEVER}_CONTINUE 2022-12-19 15:08:08 -05:00
ext libstdc++: Fix some -Wunused warnings in tests 2022-12-09 00:33:46 +00:00
parallel Update copyright years. 2022-01-03 10:42:10 +01:00
precompiled libstdc++: Implement C++20 <format> [PR104166] 2022-11-13 01:10:44 +00:00
pstl libstdc++: Declare const global variables inline 2022-11-06 11:30:47 -05:00
std libstdc++: Reduce size of std::bind_front(empty_type) result [PR108290] 2023-01-05 16:28:43 +00:00
tr1 libstdc++: Mark headers that must be hosted as such [PR103626] 2022-10-03 15:43:48 +01:00
tr2 Update copyright years. 2022-01-03 10:42:10 +01:00
Makefile.am libstdc++: Add std::format support to <chrono> 2022-12-22 23:34:27 +00:00
Makefile.in libstdc++: Add std::format support to <chrono> 2022-12-22 23:34:27 +00:00