|
|
6f08b4 |
commit 29dad307b5d7cfdb6626c11c8e43ebff941c950b
|
|
|
6f08b4 |
Author: Jonathan Wakely <jwakely@redhat.com>
|
|
|
6f08b4 |
Date: Thu Mar 11 16:43:51 2021 +0000
|
|
|
6f08b4 |
|
|
|
6f08b4 |
libstdc++: Initialize std::normal_distribution::_M_saved [PR 99536]
|
|
|
6f08b4 |
|
|
|
6f08b4 |
This avoids a false positive -Wmaybe-uninitialized warning, by
|
|
|
6f08b4 |
initializing _M_saved on construction.
|
|
|
6f08b4 |
|
|
|
6f08b4 |
libstdc++-v3/ChangeLog:
|
|
|
6f08b4 |
|
|
|
6f08b4 |
PR libstdc++/99536
|
|
|
6f08b4 |
* include/bits/random.h (normal_distribution): Use
|
|
|
6f08b4 |
default-initializer for _M_saved and _M_saved_available.
|
|
|
6f08b4 |
|
|
|
6f08b4 |
(cherry picked from commit 67e397660611990efd98f9e4106c1ee81f6803a4)
|
|
|
6f08b4 |
|
|
|
6f08b4 |
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
|
|
|
6f08b4 |
index b36781ed290..3385345d273 100644
|
|
|
6f08b4 |
--- a/libstdc++-v3/include/bits/random.h
|
|
|
6f08b4 |
+++ b/libstdc++-v3/include/bits/random.h
|
|
|
6f08b4 |
@@ -1974,12 +1974,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|
|
6f08b4 |
explicit
|
|
|
6f08b4 |
normal_distribution(result_type __mean = result_type(0),
|
|
|
6f08b4 |
result_type __stddev = result_type(1))
|
|
|
6f08b4 |
- : _M_param(__mean, __stddev), _M_saved_available(false)
|
|
|
6f08b4 |
+ : _M_param(__mean, __stddev)
|
|
|
6f08b4 |
{ }
|
|
|
6f08b4 |
|
|
|
6f08b4 |
explicit
|
|
|
6f08b4 |
normal_distribution(const param_type& __p)
|
|
|
6f08b4 |
- : _M_param(__p), _M_saved_available(false)
|
|
|
6f08b4 |
+ : _M_param(__p)
|
|
|
6f08b4 |
{ }
|
|
|
6f08b4 |
|
|
|
6f08b4 |
/**
|
|
|
6f08b4 |
@@ -2158,8 +2158,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|
|
6f08b4 |
const param_type& __p);
|
|
|
6f08b4 |
|
|
|
6f08b4 |
param_type _M_param;
|
|
|
6f08b4 |
- result_type _M_saved;
|
|
|
6f08b4 |
- bool _M_saved_available;
|
|
|
6f08b4 |
+ result_type _M_saved = 0;
|
|
|
6f08b4 |
+ bool _M_saved_available = false;
|
|
|
6f08b4 |
};
|
|
|
6f08b4 |
|
|
|
6f08b4 |
/**
|