[Boost-bugs] [Boost C++ Libraries] #10073: Uninitialized variable in boost::multiprecision::sqrt

Subject: [Boost-bugs] [Boost C++ Libraries] #10073: Uninitialized variable in boost::multiprecision::sqrt
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-27 08:43:27


#10073: Uninitialized variable in boost::multiprecision::sqrt
---------------------------------+----------------------------
 Reporter: adammerz@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: Boost 1.56.0 | Component: multiprecision
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: multiprecision sqrt |
---------------------------------+----------------------------
 The variable `t` in `boost::multiprecision::sqrt` is default-initialized.
 This is fine when `sqrt` is called with a multiprecision type e.g.
 `cpp_int`, but when called with a primitive scalar e.g. `unsigned`, it
 causes the result of `sqrt` to be incorrect.

 The fix is simply to change `Integer t;` to `Integer t = 0;`. I've tested
 locally and the results appear fine afterwards.

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