From a20d9fe5396585b6448aa13c5f6cf8d111b7b7f5 Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Wed, 2 Oct 2013 16:14:55 +0300
Subject: xtensa: fix atomic_decrement_if_positive() return value

atomic_decrement_if_positive() returns the old value of &mem, not the
(sometimes undefined) value of __tmp.

Fixes the uClibc nptl/tst-sem3 test.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Chris Zankel <chris@zankel.net>
---
 libc/sysdeps/linux/xtensa/bits/atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'libc')

diff --git a/libc/sysdeps/linux/xtensa/bits/atomic.h b/libc/sysdeps/linux/xtensa/bits/atomic.h
index a31841a4b..b2be547f0 100644
--- a/libc/sysdeps/linux/xtensa/bits/atomic.h
+++ b/libc/sysdeps/linux/xtensa/bits/atomic.h
@@ -154,7 +154,7 @@ typedef uintmax_t uatomic_max_t;
       : "=&a" (__value), "=&a" (__tmp)                               \
       : "a" (mem)                                                    \
       : "memory" );                                                  \
-    __tmp;                                                           \
+    __value;                                                         \
   })
 
 
-- 
cgit v1.2.3