[Boost-bugs] [Boost C++ Libraries] #12330: boost::thread starts with invalid FPU control word value in Embarcadero C++ Builder

Subject: [Boost-bugs] [Boost C++ Libraries] #12330: boost::thread starts with invalid FPU control word value in Embarcadero C++ Builder
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-07-18 11:00:25


#12330: boost::thread starts with invalid FPU control word value in Embarcadero C++
Builder
-------------------------------------------------+-------------------------
 Reporter: Ville-Valtteri Tiittanen <ville- | Owner: anthonyw
  valtteri.tiittanen@…> | Status: new
     Type: Bugs | Component: thread
Milestone: To Be Determined | Severity: Regression
  Version: Boost 1.55.0 |
 Keywords: |
-------------------------------------------------+-------------------------
 When the following program is compiled in Embarcadero C++ Builder 10.1,
 boost::thread does not correctly inherit floating point control word value
 from the parent thread. Instead, _fpreset() must be called in the
 beginning of every thread to make sure the value is correct.

 std::thread seems to work correctly.

 I am using Embarcadero C++ Builder 10.1 (compiler bcc32c version 3.3.1)
 and Boost 1.55.0. My environment is Windows 7, and I am building for
 32-bit Windows target.


 {{{
 #include <tchar.h>
 #include <thread>
 #define BOOST_THREAD_USE_LIB
 #include <boost/thread.hpp>
 #include <cstdio>
 #include <cfloat>

 namespace boost { void tss_cleanup_implemented() { } }

 void print_cw()
 {
         const unsigned int cw = _control87(0, 0);
         printf("%X\n", cw);
 }

 void print_cw_2()
 {
         // Reset FPU precision to default
         _fpreset();
         print_cw();
 }

 int _tmain(int argc, _TCHAR* argv[])
 {
         print_cw();

         std::thread t1(&print_cw);
         t1.join();

         boost::thread t2(&print_cw);
         t2.join();

         boost::thread t3(&print_cw_2);
         t3.join();

         getchar();
         return 0;
 }
 }}}

 Output:


 {{{
 1372
 1372
 27F
 1372
 }}}

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