On 12/05/17 12:10 +0200, Richard Biener wrote:
It was pointed out by Markus that the EH emergency pool is not kept sorted and fully merged properly for the cases of freeing an entry before the first free entry and for the cases where merging with the immediate successor and for the case with merging with both successor and predecessor is possible. The following patch attempts to fix this. Bootstrap and regtest running on x86_64-unknown-linux-gnu. Ok for trunk? (given low / close to no testing coverage extra close eyes wanted!) Reporter says maybe it can't happen in real-life as it requires EH deallocation order not be the reverse of allocation order. I don't know enough here for a quick guess but "in C++ everything is possible" ;)
It's definitely possible. std::exception_ptr p1, p2; try { throw 1; } catch (...) { p1 = std::current_exception(); } try { throw 2; } catch (...) { p2 = std::current_exception(); } Both exceptions are still active, and their lifetimes are now tied to value objects which can be reset, swapped, copied etc. so their lifetime is now arbitrary.