[gcc(refs/users/aoliva/heads/testme)] testsuite: tolerate compare_exchange_weak spurious failure
Alexandre Oliva
aoliva@gcc.gnu.org
Tue Mar 10 07:55:10 GMT 2026
https://gcc.gnu.org/g:594bb2a6c8cf25da6a2981204cc25603100346dc
commit 594bb2a6c8cf25da6a2981204cc25603100346dc
Author: Alexandre Oliva <oliva@adacore.com>
Date: Tue Mar 10 04:38:07 2026 -0300
testsuite: tolerate compare_exchange_weak spurious failure
compare_exchange_weak is allowed to fail spuriously, and we're
actually hitting such spurious failures quite often on ppc-vx7r2,
presumably when random interrupts hit between ll and sc.
Tolerate one such failure, hopefully that will suffice.
for libstdc++-v3/ChangeLog
* testsuite/29_atomics/atomic/compare_exchange_padding.cc:
Tolerate one compare_exchange_weak spurious failure.
Diff:
---
libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
index d9c7b90c1a5c..3fc2f6b4f803 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
@@ -37,8 +37,8 @@ main ()
fill_struct(n);
n.c = 'b';
n.s = 71;
- // padding cleared on compexchg
- VERIFY( as.compare_exchange_weak(s, n) );
+ // padding cleared on compexchg. tolerate one spurious _weak failure.
+ VERIFY( as.compare_exchange_weak(s, n) || as.compare_exchange_weak(s, n) );
VERIFY( as.compare_exchange_strong(n, s) );
return 0;
}
More information about the Gcc-cvs
mailing list