From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id B04C6388A43A; Tue, 20 Apr 2021 18:52:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B04C6388A43A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r9-9374] libstdc++: Initialize std::normal_distribution::_M_saved [PR 99536] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-9 X-Git-Oldrev: d7bc0ab9700ad2e235f52eac58c36848d67be455 X-Git-Newrev: 29dad307b5d7cfdb6626c11c8e43ebff941c950b Message-Id: <20210420185244.B04C6388A43A@sourceware.org> Date: Tue, 20 Apr 2021 18:52:44 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 18:52:44 -0000 https://gcc.gnu.org/g:29dad307b5d7cfdb6626c11c8e43ebff941c950b commit r9-9374-g29dad307b5d7cfdb6626c11c8e43ebff941c950b Author: Jonathan Wakely Date: Thu Mar 11 16:43:51 2021 +0000 libstdc++: Initialize std::normal_distribution::_M_saved [PR 99536] This avoids a false positive -Wmaybe-uninitialized warning, by initializing _M_saved on construction. libstdc++-v3/ChangeLog: PR libstdc++/99536 * include/bits/random.h (normal_distribution): Use default-initializer for _M_saved and _M_saved_available. (cherry picked from commit 67e397660611990efd98f9e4106c1ee81f6803a4) Diff: --- libstdc++-v3/include/bits/random.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index b36781ed290..3385345d273 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -2016,12 +2016,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit normal_distribution(result_type __mean, result_type __stddev = result_type(1)) - : _M_param(__mean, __stddev), _M_saved_available(false) + : _M_param(__mean, __stddev) { } explicit normal_distribution(const param_type& __p) - : _M_param(__p), _M_saved_available(false) + : _M_param(__p) { } /** @@ -2158,8 +2158,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const param_type& __p); param_type _M_param; - result_type _M_saved; - bool _M_saved_available; + result_type _M_saved = 0; + bool _M_saved_available = false; }; /**