[Boost-bugs] [Boost C++ Libraries] #8700: multiprecision : Trying to cast to unsigned from cpp_int > 19 bits causes crash

Subject: [Boost-bugs] [Boost C++ Libraries] #8700: multiprecision : Trying to cast to unsigned from cpp_int > 19 bits causes crash
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-16 01:53:50


#8700: multiprecision : Trying to cast to unsigned from cpp_int > 19 bits causes
crash
--------------------------------------------+----------------------------
 Reporter: danq@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
  Version: Boost 1.53.0 | Severity: Showstopper
 Keywords: crash cast multiprecision dump |
--------------------------------------------+----------------------------
 The code segment below shows an iteration through a list of fields. Each
 field will be filled with a sub-set of the cpp_int number.

 If the cpp_int number is 20-bits or larger, the second line of the 'for'
 loop (where the cast to unsigned occurs) crashes bit-time.

 When I comment out the cast, the code works file. If I reduce the size of
 the cpp_int 'i_addr' to 19 bits or less, it works fine.

 20 bits or more causes a complete crash.

 Ticket #8423 comments about a similar crash and that it was fixed for the
 next release. I was unable to find the fix. Note that in that example,
 the 32-bit value crashes while the 16-bit one does not.

 Very similar to my case, so I suspect it is the same bug.

 Can someone please confirm this?



 Mingw 10.2 -
 GCC 4.8.1 - Boost 1.53.0 - FreeType 2.4.12, libogg 1.3.1, PCRE 8.33,
 pngcrush 1.7.60.


 //-----------------------------------------------------------//

 typedef boost :: multiprecision :: cpp_int Bit_Reg ;

 Bit_Reg i_addr ; // This is incremented elsewhere, but used in this
 loop

 for (auto * i_field : table->i_field_list)
 {
   Bit_Reg i_value = i_addr >> i_field->bits.lsb ;

   i_field->value = i_value.template convert_to <unsigned> () ;
 }

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