Boost logo

Boost :

Subject: Re: [boost] clang-3.6 thread sanitizercomplainsonshared_ptroperations
From: Gaetano Mendola (mendola_at_[hidden])
Date: 2015-01-24 15:19:40


On 01/24/2015 08:35 PM, Peter Dimov wrote:
> Gaetano Mendola wrote:
>
>> I tried tonight to see if the BOOST_SP_USE_STD_ATOMIC fixes the warning on my own real code but it doesn't.
>
> ...
>
>> now defining BOOST_SP_USE_STD_ATOMIC:
>
> ...
>
>> #2 boost::detail::sp_counted_base::destroy() /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:126 (a.out+0x0000004ca97c)
>
> It uses sp_counted_base_gcc_x86.hpp, so the define didn't take hold. What probably happens is that you're using an older Boost version which doesn't have the support for std::atomic, so the define doesn't work. The tests that worked probably used a newer Boost.
>
> You wrote earlier:
>
>>>> I'm using clang 3.6 with boost 1.54
>
> and sure enough, 1.54 didn't have BOOST_SP_USE_STD_ATOMIC:
>
> https://github.com/boostorg/smart_ptr/blob/boost-1.54.0/include/boost/smart_ptr/detail/sp_counted_base.hpp
>
> 1.56 does:
>
> https://github.com/boostorg/smart_ptr/blob/boost-1.56.0/include/boost/smart_ptr/detail/sp_counted_base.hpp
>
> If you want to remain on 1.54, you can patch your sp_counted_base.hpp either with the
>
> #elif defined( BOOST_SP_USE_STD_ATOMIC )
> # include <boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp>
>
> part (adding of course sp_counted_base_std_atomic.hpp), or with the new clang-specific version I referenced in my post:

ok, I see why then, may be is worth to open an issue with clang guys, after all boost 1.54 smart pointer as it is is not
bugged, it's clang fault not recognizing the memory access.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk