]> 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 15:36:59 +0000 (19:36 +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 2f031454f56bf95b3c1ed5decde6e0acba1c08b7..dd29848f577587737e9543b172c9d945aa649b7f 100644 (file)
@@ -242,7 +242,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;