Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11989: gcc 5.3 optimizer mangles non_blocking_recvfrom
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-02-23 11:35:16
#11989: gcc 5.3 optimizer mangles non_blocking_recvfrom
-------------------------------+----------------------------
Reporter: tmark@⦠| Owner: chris_kohlhoff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
Version: Boost 1.58.0 | Severity: Optimization
Resolution: | Keywords:
-------------------------------+----------------------------
Comment (by tmark@â¦):
After further analysis we've discovered that the optimizer does not remove
the tests, it alters the comparison of (ec == enumerated value). If one
replaces the "ec" with "ec.value()" in the expressions, such that you are
explicitly comparing the interger error value the code works correctly
when optimized:
{{{
:
// Retry operation if interrupted by signal.
if (ec.value() == boost::asio::error::interrupted)
continue;
// Check if we need to run the operation again.
if (ec.value() == boost::asio::error::would_block
|| ec.value() == boost::asio::error::try_again)
return false;
:
}}}
Alternatively, adding an inline operator:
{{{
inline friend bool operator==( const error_code & lhs,
const int & rhs )
BOOST_SYSTEM_NOEXCEPT
{
return lhs.m_val == rhs;
}
}}}
to error_code class also cures the issue.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11989#comment:1> 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-02-16 18:50:19 UTC