libpmemobj-cpp icon indicating copy to clipboard operation
libpmemobj-cpp copied to clipboard

std::atomic<self_relative_ptr>::compare_exchange (and others) is incorrectly marked as noexcept

Open igchor opened this issue 5 years ago • 0 comments

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

  1. Remove noexcept specifier
  2. 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?)

igchor avatar Sep 02 '20 12:09 igchor