libpmemobj-cpp
libpmemobj-cpp copied to clipboard
std::atomic<self_relative_ptr>::compare_exchange (and others) is incorrectly marked as noexcept
ISSUE: std::atomic<self_relative_ptr>::compare_exchange (and others) is incorrectly marked as noexcept
Please provide a reproduction of the bug:
Bug found by coverity.
Details
compare_exchange takes a value_type& expected parameter (a reference to self_relative_ptr). If compare_exchange fails, a new value is assigned to expected. This can cause an exception from detail::conditional_add_to_tx.
Possible solutions
- Remove noexcept specifier
- Force expected to be in volatile memory (does it make sense to have it on pmem? if yes, is it safe to call compare_excahneg inside tx?)