Browse Source

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>
Baruch Siach 10 years ago
parent
commit
a20d9fe539
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libc/sysdeps/linux/xtensa/bits/atomic.h

+ 1 - 1
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;                                                         \
   })