1096
|
1 --- boost/atomic/detail/cas128strong.hpp
|
|
2 +++ boost/atomic/detail/cas128strong.hpp
|
|
3 @@ -196,15 +196,17 @@ class base_atomic<T, void, 16, Sign>
|
|
4
|
|
5 public:
|
|
6 BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
|
7 - explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
|
|
8 + explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
|
|
9 {
|
|
10 + memset(&v_, 0, sizeof(v_));
|
|
11 memcpy(&v_, &v, sizeof(value_type));
|
|
12 }
|
|
13
|
|
14 void
|
|
15 store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
|
16 {
|
|
17 - storage_type value_s = 0;
|
|
18 + storage_type value_s;
|
|
19 + memset(&value_s, 0, sizeof(value_s));
|
|
20 memcpy(&value_s, &value, sizeof(value_type));
|
|
21 platform_fence_before_store(order);
|
|
22 platform_store128(value_s, &v_);
|
|
23 @@ -247,7 +249,9 @@ class base_atomic<T, void, 16, Sign>
|
|
24 memory_order success_order,
|
|
25 memory_order failure_order) volatile BOOST_NOEXCEPT
|
|
26 {
|
|
27 - storage_type expected_s = 0, desired_s = 0;
|
|
28 + storage_type expected_s, desired_s;
|
|
29 + memset(&expected_s, 0, sizeof(expected_s));
|
|
30 + memset(&desired_s, 0, sizeof(desired_s));
|
|
31 memcpy(&expected_s, &expected, sizeof(value_type));
|
|
32 memcpy(&desired_s, &desired, sizeof(value_type));
|
|
33
|
|
34 --- boost/atomic/detail/gcc-atomic.hpp
|
|
35 +++ boost/atomic/detail/gcc-atomic.hpp
|
|
36 @@ -958,14 +958,16 @@ class base_atomic<T, void, 16, Sign>
|
|
37
|
|
38 public:
|
|
39 BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
|
40 - explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
|
|
41 + explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
|
|
42 {
|
|
43 + memset(&v_, 0, sizeof(v_));
|
|
44 memcpy(&v_, &v, sizeof(value_type));
|
|
45 }
|
|
46
|
|
47 void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
|
48 {
|
|
49 - storage_type tmp = 0;
|
|
50 + storage_type tmp;
|
|
51 + memset(&tmp, 0, sizeof(tmp));
|
|
52 memcpy(&tmp, &v, sizeof(value_type));
|
|
53 __atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
|
|
54 }
|
|
55 @@ -980,7 +982,8 @@ class base_atomic<T, void, 16, Sign>
|
|
56
|
|
57 value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
|
58 {
|
|
59 - storage_type tmp = 0;
|
|
60 + storage_type tmp;
|
|
61 + memset(&tmp, 0, sizeof(tmp));
|
|
62 memcpy(&tmp, &v, sizeof(value_type));
|
|
63 tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
|
|
64 value_type res;
|
|
65 @@ -994,7 +997,9 @@ class base_atomic<T, void, 16, Sign>
|
|
66 memory_order success_order,
|
|
67 memory_order failure_order) volatile BOOST_NOEXCEPT
|
|
68 {
|
|
69 - storage_type expected_s = 0, desired_s = 0;
|
|
70 + storage_type expected_s, desired_s;
|
|
71 + memset(&expected_s, 0, sizeof(expected_s));
|
|
72 + memset(&desired_s, 0, sizeof(desired_s));
|
|
73 memcpy(&expected_s, &expected, sizeof(value_type));
|
|
74 memcpy(&desired_s, &desired, sizeof(value_type));
|
|
75 const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false,
|
|
76 @@ -1010,7 +1015,9 @@ class base_atomic<T, void, 16, Sign>
|
|
77 memory_order success_order,
|
|
78 memory_order failure_order) volatile BOOST_NOEXCEPT
|
|
79 {
|
|
80 - storage_type expected_s = 0, desired_s = 0;
|
|
81 + storage_type expected_s, desired_s;
|
|
82 + memset(&expected_s, 0, sizeof(expected_s));
|
|
83 + memset(&desired_s, 0, sizeof(desired_s));
|
|
84 memcpy(&expected_s, &expected, sizeof(value_type));
|
|
85 memcpy(&desired_s, &desired, sizeof(value_type));
|
|
86 const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true,
|
|
87 --
|