* [PATCH] Fix sub-word CAS synthesis on LP64 targets
@ 2014-10-24 4:36 Andrew Waterman
0 siblings, 0 replies; only message in thread
From: Andrew Waterman @ 2014-10-24 4:36 UTC (permalink / raw)
To: gcc-patches; +Cc: Andrew Waterman
A missing cast causes the compare value to be truncated, resulting in
spurious CAS failures.
The problem manifested in a new port I'm working on as a failure in test
gcc.dg/atomic/c11-atomic-exec-2.c, and I've confirmed that this patch
fixes it. I also verified that x86_64-unknown-linux still bootstraps
(which is admittedly vacuous, since x86-64 doesn't exercise this code).
2014-10-23 Andrew Waterman <waterman@cs.berkeley.edu>
* cas_n.c (libat_compare_exchange): Add missing cast.
---
libatomic/cas_n.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libatomic/cas_n.c b/libatomic/cas_n.c
index 801262d..a885afa 100644
--- a/libatomic/cas_n.c
+++ b/libatomic/cas_n.c
@@ -70,7 +70,7 @@ SIZE(libat_compare_exchange) (UTYPE *mptr, UTYPE *eptr, UTYPE newval,
mask = -1;
}
- weval = *eptr << shift;
+ weval = (UWORD)*eptr << shift;
wnewval = (UWORD)newval << shift;
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
do
--
2.1.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-10-24 4:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-24 4:36 [PATCH] Fix sub-word CAS synthesis on LP64 targets Andrew Waterman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).