* arm/linux-atomic.c (SYNC_LOCK_RELEASE): Place memory barrier
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Dec 2009 14:26:46 +0000 (14:26 +0000)
committerrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Dec 2009 14:26:46 +0000 (14:26 +0000)
before the lock release.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154949 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/arm/linux-atomic.c

index 0c99c6e..258890d 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-03  Richard Earnshaw  <rearnsha@arm.com>
+
+       * arm/linux-atomic.c (SYNC_LOCK_RELEASE): Place memory barrier
+       before the lock release.
+
 2009-12-03  Michael Matz  <matz@suse.de>
 
        PR middle-end/38474
index 14d4a53..20ad296 100644 (file)
@@ -266,8 +266,10 @@ SUBWORD_TEST_AND_SET (char,  1)
   void HIDDEN                                                          \
   __sync_lock_release_##WIDTH (TYPE *ptr)                              \
   {                                                                    \
-    *ptr = 0;                                                          \
+    /* All writes before this point must be seen before we release     \
+       the lock itself.  */                                            \
     __kernel_dmb ();                                                   \
+    *ptr = 0;                                                          \
   }
 
 SYNC_LOCK_RELEASE (int,   4)