Subject: [Boost-bugs] [Boost C++ Libraries] #13121: std_fenced_block gets used for g++ 4.6.4 and hence buggy std::atomic_thread_fence
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-07-13 10:52:37
#13121: std_fenced_block gets used for g++ 4.6.4 and hence buggy
std::atomic_thread_fence
-----------------------------------------+----------------------------
Reporter: Richard Hazlewood <boost@â¦> | Owner: chris_kohlhoff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
Version: Boost 1.64.0 | Severity: Problem
Keywords: g++ 4.6 |
-----------------------------------------+----------------------------
With g++ 4.6.4: using {{{asio}}} code that results in
{{{detail::fenced_block}}} being used results in
{{{detail::std_fenced_block}}} being used.
This uses {{{std::atomic_thread_fence}}} but that has link issues with 4.6
(maybe https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51038).
{{{g++4.6 -std=c++0x -I boost... }}}
{{{
#include <boost/asio/detail/fenced_block.hpp>
#ifdef BOOST_ASIO_HAS_STD_ATOMIC
# pragma message("Will use asio std_fenced_block")
#endif
int main(int argc, char *argv[])
{
(void)argc; (void)argv;
boost::asio::detail::fenced_block
block(boost::asio::detail::fenced_block::full);
}
}}}
boost_asio.cpp:4:51: note: #pragma message: Will use asio std_fenced_block
/tmp/ccNS0287.o: In function
`boost::asio::detail::std_fenced_block::std_fenced_block(boost::asio::detail::std_fenced_block::full_t)':
boost_asio.cpp:(.text._ZN5boost4asio6detail16std_fenced_blockC2ENS2_6full_tE[_ZN5boost4asio6detail16std_fenced_blockC5ENS2_6full_tE]+0x22):
undefined reference to `std::atomic_thread_fence(std::memory_order)'
/tmp/ccNS0287.o: In function
`boost::asio::detail::std_fenced_block::~std_fenced_block()':
boost_asio.cpp:(.text._ZN5boost4asio6detail16std_fenced_blockD2Ev[_ZN5boost4asio6detail16std_fenced_blockD5Ev]+0x13):
undefined reference to `std::atomic_thread_fence(std::memory_order)'
collect2: ld returned 1 exit status
It looks like between 1.63 and 1.64, in ''detail/fenced_block.hpp'', the
{{{#elif defined(BOOST_ASIO_HAS_STD_ATOMIC)}}} line takes precedence over
the specific gcc test. However, {{{BOOST_ASIO_HAS_STD_ATOMIC}}} is
defined for 4.6.4.
-- Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13121> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-07-13 10:55:27 UTC