public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9592] libstdc++: Initialize std::normal_distribution::_M_saved [PR 99536]
@ 2021-03-29 20:03 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-03-29 20:03 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:039fc1ff2b018aaba5203c89de64ddc02c7a5c17
commit r10-9592-g039fc1ff2b018aaba5203c89de64ddc02c7a5c17
Author: Jonathan Wakely <jwakely@redhat.com>
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 0be1191e07d..cba11299360 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -2022,12 +2022,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)
{ }
/**
@@ -2164,8 +2164,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;
};
/**
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-29 20:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 20:03 [gcc r10-9592] libstdc++: Initialize std::normal_distribution::_M_saved [PR 99536] Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).