Boost logo

Boost :

Subject: Re: [boost] clang-3.6 thread sanitizercomplainsonshared_ptroperations
From: Peter Dimov (lists_at_[hidden])
Date: 2015-01-24 14:35:58

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:

1.56 does:

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:

Boost list run by bdawes at, gregod at, cpdaniel at, john at