diff options
author | Abseil Team <absl-team@google.com> | 2022-01-04 07:59:44 -0800 |
---|---|---|
committer | Andy Getz <durandal@google.com> | 2022-01-04 12:38:14 -0500 |
commit | c498947f8cf6dd4eb7bf4d589ca0f3816fd77d36 (patch) | |
tree | bf07c0c5fea56795732d90adc456cbb43a3e5a1f /absl/flags/internal | |
parent | 04610889a913d29037205ca72e9d7fd7acc925fe (diff) |
Export of internal Abseil changes
--
620668e56950d7cfc39db2cd321adf265199ad77 by Abseil Team <absl-team@google.com>:
absl::random compiles (at least for some cases) with -Wconversion -Wsign-compare
PiperOrigin-RevId: 419595521
--
746651e5fbcab6080d25c4eef8617fc289a448f6 by Abseil Team <absl-team@google.com>:
Annotate FlagImpl storage buffer
Flag type can contain legit uninitialized bits, e.g. padding.
When the code calls bit_cast as int64_t, it will contain those bits as well.
Then when we pass the int into the store it's UB for C++ and will be
reported by the new msan.
PiperOrigin-RevId: 418666492
GitOrigin-RevId: 620668e56950d7cfc39db2cd321adf265199ad77
Change-Id: Idd1190f5c98a0a13c4019f3d92cec0313822084c
Diffstat (limited to 'absl/flags/internal')
-rw-r--r-- | absl/flags/internal/flag.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/absl/flags/internal/flag.cc b/absl/flags/internal/flag.cc index 7102559e..55892d77 100644 --- a/absl/flags/internal/flag.cc +++ b/absl/flags/internal/flag.cc @@ -30,6 +30,7 @@ #include "absl/base/call_once.h" #include "absl/base/casts.h" #include "absl/base/config.h" +#include "absl/base/dynamic_annotations.h" #include "absl/base/optimization.h" #include "absl/flags/config.h" #include "absl/flags/internal/commandlineflag.h" @@ -160,6 +161,8 @@ void FlagImpl::Init() { std::memcpy(buf.data() + Sizeof(op_), &initialized, sizeof(initialized)); } + // Type can contain valid uninitialized bits, e.g. padding. + ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(buf.data(), buf.size()); OneWordValue().store(absl::bit_cast<int64_t>(buf), std::memory_order_release); break; |