From 54022b0debdafa84faaef197f486fa83c68c22a4 Mon Sep 17 00:00:00 2001 From: Andy Getzendanner Date: Wed, 24 Aug 2022 13:18:18 -0700 Subject: Switch time_state to explicit default initialization instead of value initialization. It looks to me like the language rules treat these the same for this type, but evidently GCC feels differently. This only matters under TSAN where SpinLock has a non-trivial destructor, and under C++20 where ABSL_CONST_INIT is implemented (as constinit) by gcc. Fixes #1253 PiperOrigin-RevId: 469806751 Change-Id: Ic01b0142101f361bc19c95f9f9474e635669c58d --- absl/time/clock.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'absl/time') diff --git a/absl/time/clock.cc b/absl/time/clock.cc index dba31611..2bf53d9c 100644 --- a/absl/time/clock.cc +++ b/absl/time/clock.cc @@ -196,7 +196,7 @@ struct ABSL_CACHELINE_ALIGNED TimeState { absl::base_internal::SpinLock lock{absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY}; }; -ABSL_CONST_INIT static TimeState time_state{}; +ABSL_CONST_INIT static TimeState time_state; // Return the time in ns as told by the kernel interface. Place in *cycleclock // the value of the cycleclock at about the time of the syscall. -- cgit v1.2.3