|
From: Yuval L. <yu...@ya...> - 2017-03-08 15:28:39
|
Hi All, This is a follow to a discussed that took place yesterday on the irc channel, but would still like to followup on the ML for better tracking. There is a 4 years old ticket on boost's lockfree queue, here: https://svn.boost.org/trac/boost/ticket/8395 According to the discussion there there is unintialized memory being used, but they failed to change the code in a way that the valgrind error would go away. OTOH, given that the boost lockfree queue is being used under different compilers/OSs etc. it is probably not a real issue. Was wondering if you can assist in resolving that either by providing info in the boost ticket above on how to solve that in the boost code, or maybe change something in valgrind that could detect this is not a real issue. For you convenience attaching some info from the execution of the code from the above ticket. gcc version 4.9.2 (Debian 4.9.2-10), valgrind-3.10.0. Valgrind output: ==9101== Conditional jump or move depends on uninitialised value(s) ==9101== at 0x401CD1: boost::atomics::detail::base_atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>, void, 8u, false>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node> const&, boost::memory_order, boost::memory_order) volatile (gcc-atomic.hpp:812) ==9101== by 0x401934: boost::atomics::detail::base_atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>, void, 8u, false>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>&, boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>, boost::memory_order) volatile (gcc-atomic.hpp:822) ==9101== by 0x401152: bool boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::do_push<false>(int* const&) (queue.hpp:311) ==9101== by 0x400C28: boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::push(int* const&) (queue.hpp:271) ==9101== by 0x400948: main (test_lockfree.cpp:9) ==9101== ==9101== Conditional jump or move depends on uninitialised value(s) ==9101== at 0x401155: bool boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::do_push<false>(int* const&) (queue.hpp:311) ==9101== by 0x400C28: boost::lockfree::queue<int*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::push(int* const&) (queue.hpp:271) ==9101== by 0x400948: main (test_lockfree.cpp:9) Assembly code: /usr/include/boost/atomic/detail/gcc-atomic.hpp:812 storage_type expected_s = 0, desired_s = 0; memcpy(&expected_s, &expected, sizeof(value_type)); memcpy(&desired_s, &desired, sizeof(value_type)); const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true, atomics::detail::convert_memory_order_to_gcc(success_order), atomics::detail::convert_memory_order_to_gcc(failure_order)); 401cb5: 48 8b 4d e0 mov -0x20(%rbp),%rcx 401cb9: 48 8b 75 d8 mov -0x28(%rbp),%rsi 401cbd: 48 8d 55 e8 lea -0x18(%rbp),%rdx 401cc1: 48 8b 02 mov (%rdx),%rax 401cc4: f0 48 0f b1 0e lock cmpxchg %rcx,(%rsi) 401cc9: 48 89 c1 mov %rax,%rcx 401ccc: 0f 94 c0 sete %al 401ccf: 84 c0 test %al,%al 401cd1: 75 03 jne 401cd6 <_ZNV5boost7atomics6detail11base_atomicINS_8lockfree6detail10tagged_ptrINS3_5queueIPiNS_9parameter5void_ES9_S9_E4nodeEEEvLj8ELb0EE21compare_exchange_weakERSC_RKSC_NS_12memory_orderESH_+0xc0> 401cd3: 48 89 0a mov %rcx,(%rdx) 401cd6: 88 45 ff mov %al,-0x1(%rbp) Please let me know if more info is needed. Best Regards, Yuval |