Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UnitCL] Fix C11Atomics_73_*, C11Atomics_74_*, C11Atomics_75_*
These tests test atomic_compare_exchange_weak_explicit which is allowed to fail for no clear reason. The test tries to account for this by detecting output differences, using that to set a weak_exchange_failed boolean, and using that weak_exchange_failed boolean to detect where the result of atomic_compare_exchange_weak_explicit does not match expectations. That is, in output_reference, it does: if (value == expected_values[success_index]) { weak_exchange_failed = true; return true; } Then, bool_output_reference is: [success_index, weak_exchange_failed](size_t index) { return index == success_index && !weak_exchange_failed; }; The problem here is that bool_output_reference is constructed capturing weak_exchange_failed by value, so it will never pick up the updated value even if it was detected that the weak exchange had failed. To fix this, capture it by reference instead.
- Loading branch information