[Boost-bugs] [Boost C++ Libraries] #4085: GCC warnings in normal_distribution.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #4085: GCC warnings in normal_distribution.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-04-11 22:13:30

#4085: GCC warnings in normal_distribution.hpp
 Reporter: bluescarni@… | Owner: no-maintainer
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: random
  Version: Boost 1.42.0 | Severity: Cosmetic
 Keywords: |
 GCC 4.4.3 with '-Wall -Wextra' compilation flags produce the following
 warning when compiling code using normal_distribution.hpp:

 warning: ‘delta.boost::variate_generator<boost::lagged_fibonacci607&,
>::_dist.boost::normal_distribution<double>::_r1’ may be used
 uninitialized in this function

 Indeed, both constructor of normal_distribution.hpp do not initialise the
 _r1, _r2 and _cached_rho members. It seems to me this has no consequences,
 because the logic of operator() initialises them as needed, but probably
 GCC is unable to detect this.

 The proposed patch (against 1.42.0) initialises to zero the _r1, _r2 and
 _cached_rho data members in both constructors.

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