]> granicus.if.org Git - libatomic_ops/commitdiff
Fix AO_stack_push_release to workaround bug in clang-1.1/x86
authorIvan Maidanski <ivmai@mail.ru>
Wed, 7 Mar 2012 03:41:23 +0000 (07:41 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 7 Mar 2012 13:43:28 +0000 (17:43 +0400)
* src/atomic_ops_stack.c (AO_stack_push_release): Make "cptr" local
variable volatile to workaround a bug in clang-1.1/x86 compiler; add
comment.

src/atomic_ops_stack.c

index d7baae0f5cc60a4b9666c7174f97171099b06da3..b3ae513c35d31000e4814d81e7c84673ab9a95e8 100644 (file)
@@ -241,7 +241,13 @@ void AO_stack_push_release(AO_stack_t *list, AO_t *element)
 
 AO_t *AO_stack_pop_acquire(AO_stack_t *list)
 {
-    AO_t *cptr;
+#   ifdef __clang__
+      AO_t *volatile cptr;
+                        /* Use volatile to workaround a bug in          */
+                        /* clang-1.1/x86 causing test_stack failure.    */
+#   else
+      AO_t *cptr;
+#   endif
     AO_t next;
     AO_t cversion;