Opened 5 years ago
Last modified 5 years ago
#13121 new Bugs
std_fenced_block gets used for g++ 4.6.4 and hence buggy std::atomic_thread_fence
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.64.0 | Severity: | Problem |
Keywords: | g++ 4.6 | Cc: |
Description
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.
Attachments (1)
Change History (2)
by , 5 years ago
Attachment: | boost_1_64_0-asio.patch added |
---|
comment:1 by , 5 years ago
The patch worked for me. Using gcc version 4.6.3 (Debian 4.6.3-14+rpi1) on Raspian. Fixed the compile issue.
One example patch