[Boost-bugs] [Boost C++ Libraries] #9739: "-ftrapv" + multiprecision results in crash at startup

Subject: [Boost-bugs] [Boost C++ Libraries] #9739: "-ftrapv" + multiprecision results in crash at startup
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-03-04 16:52:59


#9739: "-ftrapv" + multiprecision results in crash at startup
------------------------------+----------------------------
 Reporter: MaxBarraclough | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: |
------------------------------+----------------------------
 If the following file is compiled with g++ or clang++ ''without'' using
 the "-ftrapv" flag, it runs fine, irrespective of which lines are
 commented out.

 If we compile ''with'' "-ftrapv", with either of the ''causes crash''
 lines uncommented, then the program will crash on start-up, before even
 entering the "main" function. (The crashy code lives in a function which
 is never called.)

 This is true of both g++ and clang++.

 I am using Boost 1.55, g++ 4.8.1, clang 3.2, on Mint GNU/Linux, x86-64.


 The -ftrapv flag ( described in gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/Code-
 Gen-Options.html#index-ftrapv-2326 (spam-detection forced me to sabotage
 the link) ) ''generates traps for signed overflow on addition,
 subtraction, multiplication operations''.



 {{{
 #include <boost/multiprecision/cpp_dec_float.hpp>

 #include <boost/version.hpp>

 #if ( BOOST_VERSION != 105500 )
   #error Boost 1.55 please
 #endif

 void neverCalled() {
 //boost::multiprecision::cpp_dec_float_100 e; // ok
 //boost::multiprecision::cpp_dec_float_100 f = 42; // ok
 //boost::multiprecision::cpp_dec_float_100 g = 42.0f; // causes crash if
 -ftrapv is used
   boost::multiprecision::cpp_dec_float_100 h = 42.0; // causes crash if
 -ftrapv is used
 }

 int main() {
   return 0;
 }
 }}}

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