[Bug target/69789] g++ -O2 is removing tests against a variable that can be changed

tmark at isc dot org gcc-bugzilla@gcc.gnu.org
Tue Mar 15 13:27:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69789

--- Comment #5 from Thomas Markwalder <tmark at isc dot org> ---
A bit more digging reveals that in the logic expression which fails:

{{{
    // Check if we need to run the operation again.
    if (ec == boost::asio::error::would_block
        || ec == boost::asio::error::try_again)
      return false;
}}}

The value for error_category:m_cat differs between the implicitly created
instances for would_block and try_again.

If one splits the if into two separate if statements,  the values for m_cat are
the same.  This looks a like the behavior described under "Static Variables in
Inline Functions" described here:

http://processors.wiki.ti.com/index.php/C++_Inlining_Issues


More information about the Gcc-bugs mailing list