test/contention: acquire+release contention[].exchange (#184)

It is important, in test_tasks_f, that the store of the size to the
allocated block be made visible to other processors before the store of
the pointer itself.  Otherwise, other cores are justified in reading
junk.

This manifests on PowerPC as tripping the "Deallocating with incorrect
size supplied" assertion in alloc.h:/check_size because the value read
from the allocated block may not be a size but rather an internal queue
pointer, which is implausibly large, as sizes go.
This commit is contained in:
Nathaniel Wesley Filardo
2020-05-13 14:32:28 +01:00
committed by GitHub
parent 4347701d33
commit ce47fdecfc

View File

@@ -86,7 +86,7 @@ void test_tasks_f(size_t id)
*res = size;
size_t* out =
contention[n % swapsize].exchange(res, std::memory_order_relaxed);
contention[n % swapsize].exchange(res, std::memory_order_acq_rel);
if (out != nullptr)
{