From 97c9204a952f60d13def0e321c0a92ec6dec148b Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 10 Nov 2022 16:44:30 +0200 Subject: [PATCH] Align spinlock::v_ as a `bool` because of Apple PPC32. Refs #105. --- .../boost/smart_ptr/detail/spinlock_gcc_atomic.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp b/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp index 8cd7179..d87b844 100644 --- a/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp +++ b/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp @@ -30,7 +30,16 @@ class spinlock { public: - unsigned char v_; + // `bool` alignment is required for Apple PPC32 + // https://github.com/boostorg/smart_ptr/issues/105 + // https://github.com/PurpleI2P/i2pd/issues/1726 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107590 + + union + { + unsigned char v_; + bool align_; + }; public: @@ -80,6 +89,6 @@ public: } // namespace detail } // namespace boost -#define BOOST_DETAIL_SPINLOCK_INIT {0} +#define BOOST_DETAIL_SPINLOCK_INIT {{0}} #endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED