[Boost-bugs] [Boost C++ Libraries] #12083: Rounding mode not restored when using save_state rounding struct on x64

Subject: [Boost-bugs] [Boost C++ Libraries] #12083: Rounding mode not restored when using save_state rounding struct on x64
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-03-21 17:24:42


#12083: Rounding mode not restored when using save_state rounding struct on x64
---------------------------------------+-------------------------
 Reporter: Aaron Balog <abalog@…> | Owner: dgregor
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: numeric
  Version: Boost 1.60.0 | Severity: Showstopper
 Keywords: interval numeric rounding |
---------------------------------------+-------------------------
 The rounding mode is not restored when using interval_lib's save_state
 rounding struct on x64 when an exception is thrown (Visual Studio
 2013/2015). This can have critical impact on applications. All rounding
 will remain downward after catching the exception. This bug does not
 occur in Win32.

 We've also reported this issue to Microsoft:
 https://connect.microsoft.com/VisualStudio/Feedback/Details/2487437

 Boost Repro:

 #include <boost/numeric/interval.hpp>

 void test_interval_number::test_boost_rounding()
 {
    try
    {
       boost::numeric::interval<double>::traits_type::rounding rnd;
       rnd.downward();

       throw 1;
    }
    catch (...)
    {

    }

    unsigned int fpu_flags = 0;
    errno_t err;

    err = _controlfp_s(&fpu_flags, 0, 0);
    assert(err == 0);

    assert((fpu_flags & _MCW_RC) != _RC_DOWN);
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12083>
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