Commit graph

7 commits

Author SHA1 Message Date
David Vašek
aacd827f71 tests/atomic: lower the iteration counts with spinlock-emulated atomics 2024-12-12 20:21:50 +01:00
Jan Hák
e53c99d3cb tests: fix usage of new atomic in code -- test_atomic.c 2024-12-11 17:36:20 +01:00
David Vašek
80e28bccda tests/atomic: silence false positive Coverity warning (missing lock) 2024-05-06 14:34:51 +02:00
David Vašek
3f2f89ade1 tests/atomic: workaround for a GCC optimization bug on i386
With -O1 and higher, the test of atomic_exchange_explicit() doesn't work right for 64-bit variables
on i386 (and possibly other 32-bit architectures). It seems that atomic_exchange_explicit() doesn't
exchange 64-bit values properly when it's used in a loop and GCC compiler optimization is turned
on. As a workaround, we are testing ATOMIC_XCHG on a pointer size of the given architecture.

It isn't sure yet, if atomic_exchange_explicit() is safe for 64-bit variables with GCC on i386 when
not used in a loop. Therefore, ATOMIC_XCHG should not be used on general 64-bit variables until
this GCC bug is solved.

Clang and gcc -O0 don't seem to be affected by this issue.
2024-05-06 14:34:51 +02:00
David Vašek
b323b0c5d9 tests/atomic: finish the thread early once an invalid value occurs 2024-05-06 14:34:51 +02:00
David Vašek
c994bbe175 contrib/atomic: add an atomic exchange macro 2024-04-30 14:18:43 +02:00
David Vašek
3f37ed2940 contrib: universal atomic operations 2023-11-14 16:27:57 +01:00