]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/12496 (wrong result for __atomic_add(&value, -1) when using -O0 ...
authorDavid S. Miller <davem@redhat.com>
Tue, 9 Dec 2003 05:44:00 +0000 (21:44 -0800)
committerDavid S. Miller <davem@gcc.gnu.org>
Tue, 9 Dec 2003 05:44:00 +0000 (21:44 -0800)
2003-12-08  David S. Miller  <davem@redhat.com>

PR libstdc++/12496
* config/cpu/sparc/atomicity.h (__exchange_and_add, __atomic_add):
Extend increment to _Atomic_word before giving to assembler.

From-SVN: r74466

libstdc++-v3/ChangeLog
libstdc++-v3/config/cpu/sparc/atomicity.h

index a8c8d6ffd0d33fc451e65ec7e1132fb164de1665..949801b0ddab271459d05a12afd6325705bc0e8f 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-08  David S. Miller  <davem@redhat.com>
+
+       PR libstdc++/12496
+       * config/cpu/sparc/atomicity.h (__exchange_and_add, __atomic_add):
+       Extend increment to _Atomic_word before giving to assembler.
+
 2003-12-04  Christopher Saunders  <ctsa@u.washington.edu>
 
        PR libstdc++/13290
index 23804db00b7ff91386765b631885810110772775..de044d9c61994e2770d09e0dac2574cc9c9cbef0 100644 (file)
@@ -39,6 +39,7 @@ __attribute__ ((__unused__))
 __exchange_and_add (volatile _Atomic_word *__mem, int __val)
 {
   _Atomic_word __tmp1, __tmp2;
+  _Atomic_word __val_extended = __val;
 
   __asm__ __volatile__("1:     ldx     [%2], %0\n\t"
                       "        add     %0, %3, %1\n\t"
@@ -47,7 +48,7 @@ __exchange_and_add (volatile _Atomic_word *__mem, int __val)
                       "        brnz,pn %0, 1b\n\t"
                       "         nop"
                       : "=&r" (__tmp1), "=&r" (__tmp2)
-                      : "r" (__mem), "r" (__val)
+                      : "r" (__mem), "r" (__val_extended)
                       : "memory");
   return __tmp2;
 }
@@ -57,6 +58,7 @@ __attribute__ ((__unused__))
 __atomic_add (volatile _Atomic_word* __mem, int __val)
 {
   _Atomic_word __tmp1, __tmp2;
+  _Atomic_word __val_extended = __val;
 
   __asm__ __volatile__("1:     ldx     [%2], %0\n\t"
                       "        add     %0, %3, %1\n\t"
@@ -65,7 +67,7 @@ __atomic_add (volatile _Atomic_word* __mem, int __val)
                       "        brnz,pn %0, 1b\n\t"
                       "         nop"
                       : "=&r" (__tmp1), "=&r" (__tmp2)
-                      : "r" (__mem), "r" (__val)
+                      : "r" (__mem), "r" (__val_extended)
                       : "memory");
 }