From: Ivan Maidanski Date: Wed, 7 Mar 2012 03:41:23 +0000 (+0400) Subject: Fix AO_stack_push_release to workaround bug in clang-1.1/x86 X-Git-Tag: libatomic_ops-7_3alpha2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12f90d84330c94016af01f9c1035495286834563;p=libatomic_ops Fix AO_stack_push_release to workaround bug in clang-1.1/x86 * 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. --- diff --git a/src/atomic_ops_stack.c b/src/atomic_ops_stack.c index d7baae0..b3ae513 100644 --- a/src/atomic_ops_stack.c +++ b/src/atomic_ops_stack.c @@ -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;